Skip to content
Matthew Stern edited this page Mar 28, 2021 · 1 revision

You can parse a JSON file into a graph!!

>>> import topylogic.parse as parse
>>> graph = parse.parse_json(file)

Create as json file that looks like

{
    "graph" : {
        "context" : 1,
        "mem_option" : 1,
        "lvl_verbose": 15,
        "max_state": 4,
        "max_loop": 1000,
        "vertices" : [
            1, 2, 3, 4, 6
        ],
        "edges" : [
            [1,2],
            [2,3]
        ],
        "bi_edges" : [
            [1, 4],
            [3, 6]
        ]
    }
}

The graph parameter are context, mem_option, lvl_verbose, max_state, max_loop, request_flag, and snapshot_timestamp.

The above example create a graph with vertices with id's 1, 2, 3, 4, and 6 that has an edge from 1 to 2, and 2 to 3, and bi directional edges between 1 and 4, and 3 and 6.

Clone this wiki locally