Open malarconb opened 3 years ago
Hi, Yes indeed that was a poor choice at that time to use a custom graph dataset.. I think this should be easily fixable. The only problem I see is if you want to use PSCN for edge valued graphs, is it the case ? Do you have some example so that I can check myself what is the problem ? (what type of error etc...)
Thanks for you reply!
The dataset I have is a simple list of networkx objects. Assuming the graphs are stored in a variable graphs, the looks of them would look something like this:
IN: graphs[0].nodes OUT: [1, 2, 4, 5, 6, 8, 9, 13, 14, 15, 17, 20, 26, 27, 31, 32, 33]
IN: graphs[0].edges OUT: [(1, 4), (1, 5), (1, 8), (1, 13), (1, 14), (1, 20), (1, 26), (1, 27), (1, 31), (1, 33), (2, 4), (2, 5), (2, 8), (2, 13), (2, 14), (2, 20), (2, 26), (2, 27), (2, 31), (2, 33), (4, 6), (4, 9), (4, 15), (4, 17), (4, 32), (5, 6), (5, 9), (5, 15), (5, 17), (5, 32), (6, 8), (6, 14), (6, 20), (6, 26), (6, 27), (6, 31), (6, 33), (8, 9), (8, 15), (8, 17), (8, 32), (9, 13), (9, 14), (9, 20), (9, 26), (9, 27), (9, 31), (9, 33), (13, 15), (13, 20), (13, 26), (13, 27), (13, 32), (14, 15), (14, 17), (14, 32), (15, 20), (15, 26), (15, 27), (15, 31), (15, 33), (17, 20), (17, 26), (17, 27), (17, 31), (17, 33), (20, 32), (26, 32), (27, 32), (31, 32), (32, 33)]
The graphs are just nodes and edges. Not weighted. The problem I'm getting is the following:
File "/home/owner/Downloads/PSCN-master/pscn.py", line 224, in make_ raise BadShapeError('Shapes do not match : {0} instead of {1}'.format(np.array(forcnn).shape,(self.w,self.k))) custom_errors.BadShapeError: Shapes do not match : (18, 0) instead of (18, 10)
Alright, maybe I am wrong but I suppose it is because you do not have node attributes in your graphs.
PSCN works with attributes. For some datasets where the nodes do not have attribute(e.g. IMDB) the authors add attributes based on the centrality of the node for example; (see how IMDB is constructed https://github.com/tvayer/PSCN/blob/91846770767c1e3491038017f086dc72b3a7059c/data_loader.py#L298).
Otherwise if you have your own attribute you can use the function g.add_one_attribute(node,attr) to add it to the node (by iterating over the nodes). See for example https://github.com/tvayer/PSCN/blob/91846770767c1e3491038017f086dc72b3a7059c/data_loader.py#L322. where I add the attributes based on the dictionary given by the data.
If you already tried to add attribute then can you give me some more detailed code on how do your construct your graph ?
You were right. I was precisely the lack of attributes in my graphs. However, this throws me a different error while trying to build the program with IMDB-B.
IndexError: only integers, slices (
:), ellipsis (
...), numpy.newaxis (
None) and integer or boolean arrays are valid indices
And I am even getting that same error after I add the attributes to my dataset. Any idea what could be causing this?
I'm trying to build the example as it follows:
mutag_dataset = load_local_data('./data','imdb-m', use_node_deg=True)
Hi, I'm having a hard time implementing the algorithm with my own dataset.
I have a dataset of networkx objects, say, n graphs. I transformed the networkx objects to the Graph class included in the package, but I keep getting error after error. Is it possible to load a dataset different from the ones included in the data folder? What would you recommend?
EDIT: I can run the base code with no problems with any default dataset.