CWTSLeiden / networkanalysis

Java package that provides data structures and algorithms for network analysis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error message : duplicate values while creating network

almugabo opened this issue · comments

Great tool !!!

I get the following error when I try to run the RunNetworkClustering.jar a large network .

** Error while creating network: For each node, corresponding elements of neighbors array must not include duplicate values.**

May I propose to make the error message more explicit ? Does it means that the program found at least one node (source) with same target multiple times or something else ?

Just for clarification : I double checked my input file. It does not have any duplicates (distinct) nor self-loops (source_node<> source_target).

Thanks!

Yes, perhaps we can explicitly mention the duplicate element that we encountered, we will look into it.

Note that the network is assumed to be undirected. In other words, if you have the edges listed as source node -> target node, then make sure that the reverse edge is not also present. For example, if the edge 3, 4 is included, the edge 4, 3 should not be included. Could you check whether removing such duplicates resolves the issue?

Thanks for the prompt reply.
Yes the "reciprocal" edges were the problems. When removed everything works fine.
Explicitly mentioning the "offending" can help, especially if the input network is large, find them can be time consuming.

Good to hear it is solved!

Yes, I can understand, we'll look into improving the error message. I'll leave the issue open for now.

commented

Are directed networks (and therefore multiple edges for the same nodes) possible in the algorithm? Or will it stay undirected network only?

Multiple edges are not possible in this implementation. However, multiple edges can simply be represented as a single weighted edge, with the weight the multiplicity of the edges (or the sum of the weights).

This implementation accepts only undirected networks. Note that for CPM the direction is not important, while for modularity directionality may play a role. The Python implementation does allow for directed networks with multiple edges though.

Does nodes must be continual and start from 0 ?

This is now fixed in the master branch. We now provide an explicit line numbers on errors, see commit 44829f1