graphspace_python.graphs.formatter package

Submodules

graphspace_python.graphs.formatter.json_formatter module

class graphspace_python.graphs.formatter.json_formatter.CyJSFormat[source]

Bases: object

static clean_graph_json(original_json_string)[source]

Converts original_json_string in CyJS format such that its compatible with Graphspace’s json format.

Changes to node attributes:
  1. It will copy id value to the name attribute, even if the name attribute is provided by the user.
  2. If label is used in data attributes, it will copy label value to content attribute in style attributes.
  3. If content is missing, it will add default value of name of the node
  4. Convert all shape values to lower case.
  5. Convert shape value to default value of ellipse, if a wrong value is given.
Changes to edge attributes:
  1. Add name attributes to edge data attributes.
  2. Add default target-arrow-shape value of none if not given by the user.
Changes to graph attributes/metadata:
  1. If no name is provided change the name to “graph_{{current timestamp}}”
static create_gsgraph(json_string)[source]
Parameters:json_string (json_string to be converted to GSGraph type.) –
Returns:object
Return type:GSGraph

Notes

static validate_json(original_json_string)[source]

Validates JSON string to see if all required properties for a GraphSpace Graph are provided. Cleans the JSON string to the format required for GraphSpace.

@param original_json_string: JSON string representation of the graph

Module contents