Commit fe93049a authored by ljia's avatar ljia
parents f9a60b7d 5ccc1de3
This diff is collapsed.
......@@ -14,8 +14,9 @@ def loadCT(filename):
1 3 1 1 <- each line describes an edge, the first two numbers represent two nodes of the edge, the last number represents the label. @Q what are the 3th numbers?
2 3 1 1
"""
from os.path import basename
content = open(filename).read().splitlines()
G = nx.Graph(name=str(content[0])) # set name of the graph
G = nx.Graph(name=str(content[0]),filename=basename(filename)) # set name of the graph
tmp = content[1].split(" ")
if tmp[0] == '':
nb_nodes = int(tmp[1]) # number of the nodes
......@@ -37,13 +38,14 @@ def loadCT(filename):
def loadGXL(filename):
from os.path import basename
import networkx as nx
import xml.etree.ElementTree as ET
tree = ET.parse(filename)
root = tree.getroot()
index = 0
G = nx.Graph()
G = nx.Graph(filename=basename(filename), name=root[0].attrib['id'])
dic={}
for node in root.iter('node'):
label = node.find('attr')[0].text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment