Development

Anyone can develop tools for the marketplace. We will vet the tools and can help you set a price. Contact us to post your tool.

Tool API

There is a GraphMasonAPI.py script that is downloaded with the Graph Mason app. You will need to import GraphMasonAPI to access the functions that convert the data to and from the graph.

The following will create a graph object:

import GraphMasonAPI

tempFile = sys.argv[1]
nodeIdIn = sys.argv[2]
selectedNodeIds = sys.argv[3]
highlightedNodeIds = sys.argv[4]
selectedEdgeIds = sys.argv[5]
highlightedEdgeIds = sys.argv[6]
userInput = sys.argv[7]

graph = GraphMasonAPI.getGraphObj(tempFile)

Sending Data Back

Send the data back with a print function. Separate the data with newlines: '\n'. The graph can be stringified with the following function:

graphStr = GraphMasonAPI.graphToString(graph)

The graph string begins with GR|| and other return strings should not begin this way to avoid being interpreted as graphs.

Nodes and edges can be selected with the following lines:

SELN||{a list of node id's separated by |*}

SELE||{a list of comma separated node id's separated by |*}

Nodes and edges can be highlighted with the following lines:

HIN||{a list of node id's separated by |*}

HIE||{a list of comma separated node id's separated by |*}

Any line that does not start with GR||, SELN||, SELE||, HIN||, or HIE|| will be displayed in a popup window as feedback. If there are no other lines, there will be no popup window.

If not graph is returned, the graph will not be modified.

Example Return

# Convert the graph back into string form that the application can read
graphStr = GraphMasonAPI.graphToString(graph)

print('User input:'+userInput+'\n'+graphStr+'\nSELN||'+selectedNodeIds+'\nSELE'+selectedEdgeIds)

This will open a window that shows the user's input and preserves the user's selection when the script was run.