-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphML support #3
Comments
Support what, how ? why ? |
Well GraphML is standard input for gephi like networks, standard output of R based stat tools. this import function would enable to push large amount of graphml calculated files in topo . for an example |
Yes, GraphML is Gephi standard and already supported by NetworkX and other libs : https://networkx.github.io/documentation/networkx-1.10/reference/readwrite.graphml.html No need for built-in support, you can just parse a graphML file with nx and push it to Topogram using Python. Here an (untested) example import networkx as nx
from topogram_client import TopogramAPIClient
# read graphML file
with open("network.graphml") as f:
G = nx.read_graphml(f)
# passwords
TOPOGRAM_URL = "https://app.topogram.io" # "http://localhost:3000"
USER = "xxx@xxx.com"
PASSWORD = "xxx"
# connect to the topogram instance
topogram = TopogramAPIClient(TOPOGRAM_URL)
# topogram.create_user(USER, PASSWORD)
topogram.user_login(USER, PASSWORD)
# create the graph
nodes = []
for n in G.nodes(data=True):
node = n[1]
node["id"] = n[0]
node["group"] = n[1]["type"]
nodes.append(node)
print "creating %s nodes ..."%len(nodes)
r = topogram.create_nodes(topogram_ID, nodes)
edges = []
for e in G.edges(data=True):
edge = e[2]
edge["source"] = e[0]
edge["target"] = e[1]
edges.append(edge)
print "creating %s edges ..."%len(edges)
r = topogram.create_edges(topogram_ID, edges)
print "done. Topogram is online at %s/topograms/%s"%(TOPOGRAM_URL,topogram_ID) |
We need to add support for GraphML file format.
The text was updated successfully, but these errors were encountered: