adbharadwaj/graphspace-python

Adding node style changes depending on the order of attributes added

Opened this issue · 0 comments

Hi -
We have been adding node styles one by one, e.g., adding node shapes and then adding node colors later in the code. When we do this, final graph changes depending on the order of the styles added. See, for example, these two public graphs: Attribute Order: Shape Then Color and Attribute Order: Color Then Shape. The code to reproduce them is below (except for username/password). If add_node_style() is intended to be called exactly once for each node, then this should be specified in the API and the tutorial. Thanks!

from graphspace_python.api.client import GraphSpace
from graphspace_python.graphs.classes.gsgraph import GSGraph

graphspace = GraphSpace(USERNAME, PASSWORD)

nodes = ['A','B','C','D']
edges = [['A','B'],['C','D']]

G = GSGraph()
G.set_name('Attribute Order: Color Then Shape')
for n in nodes: ## add nodes, adding color then shape styles
	G.add_node(n,label=n)
	G.add_node_style(n,color='red')
	G.add_node_style(n,shape='rectangle')
for e in edges: ## add edges
	G.add_edge(e[0],e[1])
graphspace.post_graph(G)

G = GSGraph()
G.set_name('Attribute Order: Shape Then Color')
for n in nodes: ## add nodes, adding shape then color styles
	G.add_node(n,label=n)
	G.add_node_style(n,shape='rectangle')
	G.add_node_style(n,color='red')
for e in edges: ## add edges
	G.add_edge(e[0],e[1])
graphspace.post_graph(G)