public int getPathLengthInEdges(Category node1, Category node2) {
        if (this.graph.containsVertex(node1.getPageId()) && this.graph.containsVertex(node2.getPageId())) {
            if (node1.getPageId() == node2.getPageId()) {
                return 0;
            }

            // get the path from root node to node 1
            List edgeList = DijkstraShortestPath.findPathBetween(undirectedGraph, node1.getPageId(), node2.getPageId());
            if (edgeList == null) {
                return -1;
            }
            else {
                return edgeList.size();
            }
        }
        // if the given nodes are not in the category graph, return -1
        else {
            return -1;
        }
    }
public int getPathLengthInEdges ( Category node1 , Category node2 ) { if ( this . graph . containsVertex ( node1 . getPageId ( ) ) && this . graph . containsVertex ( node2 . getPageId ( ) ) ) { if ( node1 . getPageId ( ) == node2 . getPageId ( ) ) { return 0 ; } List edgeList = DijkstraShortestPath . findPathBetween ( undirectedGraph , node1 . getPageId ( ) , node2 . getPageId ( ) ) ; if ( edgeList == null ) { return - 1 ; } else { return edgeList . size ( ) ; } } else { return - 1 ; } }
Gets the path length between two category nodes - measured in "edges".
@param node1 The first category node.
@param node2 The second category node.
@return The number of edges of the path between node1 and node2. 0, if the nodes are identical. -1, if no path exists.