Erreur lors de la création d'un graphe

Fermé
Am_d - 1 mars 2017 à 14:11
Bonjour,
Bonjour à tous;
J'essais de créer un graphe pour lui appliquer ensuite l’algorithme HITS cependant, lorsque je crée le graphe et puis j'essais d'exécuter,une erreur apparaît.
Voici comment je crée mon graphe:

public static Graph<String, Integer> createGraph1(String graphId, boolean[][] adjacencyMatrix)
{
Graph<String, Integer> g = new DirectedSparseGraph <String,Integer>();

for (int nodeId = 0; nodeId < adjacencyMatrix.length; nodeId++)
g.addVertex(getId(nodeId));



for (int nodeId = 0; nodeId < adjacencyMatrix.length; nodeId++)
for (int neighborId = 0; neighborId < adjacencyMatrix[nodeId].length; neighborId++)
if (adjacencyMatrix[nodeId][neighborId])


g.addEdge(neighborId,getId(nodeId),getId(neighborId));

return(g);

}

et voici l'erreur qui s'affiche:
Exception in thread "main" java.lang.IllegalArgumentException: edge 10 already exists in this graph with endpoints <Node 0, Node 10> and cannot be added with endpoints <Node 1, Node 10>

Est ce que quelqu'un peut m'aider SVP. C'est urgent.

A voir également: