You need to have a username and password on GraphSpace: https://graphspace.org/
from graphspace_python.api.client import GraphSpace |
from graphspace_python.graphs.classes.gsgraph import GSGraph |
from graphspace_python.graphs.classes.gsgroup import GSGroup |
from graphspace_python.graphs.classes.gslayout import GSLayout |
G = GSGraph() |
|
G.add_node('a') |
|
..., label='A', ...) |
Label to display
|
..., popup='html text', ...) |
Popup text
|
G.add_edge('a', 'b') |
|
..., directed=True, ...) |
Directed edge
|
..., popup='html text', ...) |
Popup text
|
G.set_name('My Sample Graph') |
|
G.set_tags(['sample']) |
G.add_node_style('a', shape='ellipse') |
|
..., color='blue', ...) |
Node color
|
..., color='#A152B8', ...) |
|
..., bubble='blue', ...) |
Bubble style
|
..., height=40, width=20, ...) |
Custom size
|
..., style='dashed', ...) |
|
..., border_color='red', ...) |
Border color
|
..., border_width=2, ...) |
Border width
|
add_node_style command.
G.add_edge_style('a', 'b', edge_style='dotted') |
|
..., directed=True, ...) |
Directed edge
|
..., color='#FF5733', ...) |
|
..., arrow_shape='tee', ...) |
|
..., width=4, ...) |
Edge width
|
..., color='magenta', ...) |
Edge color
|
..., arrow_fill='hollow', ...) |
|
..., width=4, ...) |
Edge width
|
add_edge_style command.
gs = GraphSpace('uname', 'psswd') |
|
graph = gs.post_graph(G) |
Post (new) graph to GraphSpace
|
graph = gs.update_graph(G) |
Update (existing) graph to GraphSpace
|
gs.delete_graph(graph=graph) |
Delete graph from GraphSpace
|
def post(G, gs):
try:
graph = gs.update_graph(G)
except:
graph = gs.post_graph(G)
return graph
graph = gs.get_graph(graph_name='My Sample Graph') |
|
graph = gs.get_graph(graph_id=12345) |
Fetch by graph id
|
graph.name |
Name of graph
|
graph.id |
ID of graph
|
gs.publish_graph(graph=graph) |
Make graph public
|
gs.unpublish_graph(graph=graph) |
Make graph private
|
mygroup = GSGroup(name='My group', description='sample group') |
|
group = gs.post_group(mygroup) |
Add group
|
group = gs.get_group(group_name='My group') |
Fetch group
|
gs.share_graph(graph=graph, group_name='My group') |
Share graph with group
|
gs.unshare_graph(graph=graph, group_name='My group') |
Remove graph from group
|
L = GSLayout() |
|
L.set_node_position('a', y=38.5, x=67.3) |
Set x and y coords
|
L.add_node_style(),L.add_edge_style() |
Add styles in layout
|
L.set_name('My Sample Layout') |
Layout name
|
L.set_is_shared(1) |
Visible to members who can see graph
|
layout = graphspace.post_graph_layout(L, graph=graph) |
Post (new) layout
|
layout = graphspace.get_graph_layout(layout_name='My Sample Layout', graph=graph) |
Fetch layout
|
layout1 = graphspace.update_graph_layout(layout) |
Update (existing) layout
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.