DeepGraphLearning / graphvite

GraphVite: A General and High-performance Graph Embedding System
https://graphvite.io
Apache License 2.0
1.22k stars 151 forks source link

Can`t load a list as a graph #52

Closed Gustarvo closed 4 years ago

Gustarvo commented 4 years ago
TypeError                                 Traceback (most recent call last)

<ipython-input-46-e1ce7f47f2f6> in <module>()
----> 1 my_graph = gv.graph.Graph.load(edge_list)

TypeError: load(): incompatible function arguments. The following argument types are supported:
    1. (self: libgraphvite.graph.Graph, file_name: str, as_undirected: bool = True, normalization: bool = False, delimiters: str = ' \t\r\n', comment: str = '#') -> None
    2. (self: libgraphvite.graph.Graph, edge_list: List[Tuple[str, str]], as_undirected: bool = True, normalization: bool = False) -> None
    3. (self: libgraphvite.graph.Graph, weighted_edge_list: List[Tuple[str, str, float]], as_undirected: bool = True, normalization: bool = False) -> None

Invoked with: [('65', '1378'), ('65', '1378'), ('65', '1378'), ('65', '1378'), ('65', '1378'), ('65', '1378'), ('65', '1378'), ('65', '1378'), ('65', '1378')...

the edge_list is a list made of tuple but i can`t load the list as a graph

I also tried saving the list in a file and load it ,but it failed either with same typeerror.

my_graph = gv.graph.Graph.load("edge_list.json")

TypeError: load(): incompatible function arguments. The following argument types are supported:
    1. (self: libgraphvite.graph.Graph, file_name: str, as_undirected: bool = True, normalization: bool = False, delimiters: str = ' \t\r\n', comment: str = '#') -> None
    2. (self: libgraphvite.graph.Graph, edge_list: List[Tuple[str, str]], as_undirected: bool = True, normalization: bool = False) -> None
    3. (self: libgraphvite.graph.Graph, weighted_edge_list: List[Tuple[str, str, float]], as_undirected: bool = True, normalization: bool = False) -> None

Invoked with: 'edge_list.json'
KiddoZhu commented 4 years ago

gv.graph.Graph is a class. You need to create an instance first.

graph = gv.graph.Graph()
graph.load(edge_list)