/** * Do not check if the graph is a DAG * * @param g * @param root * @param wc * @return true if the graph is a DAG and rooted by a unique vertex. * @throws SLIB_Ex_Critic */ public boolean isUniqueRootedDagRoot(G g, URI root, WalkConstraint wc) throws SLIB_Ex_Critic { if (isDag(g, wc)) { Set<URI> roots = getDAGRoots(g, WalkConstraintUtils.getInverse(wc, false)); logger.debug("roots: " + roots); if (roots.size() == 1 && roots.iterator().next().equals(root)) { return true; } } return false; }
/** * Do not check if the graph is a DAG * * @param g * @param root * @param wc * @return true if the graph is a DAG and rooted by a unique vertex. * @throws SLIB_Ex_Critic */ public boolean isUniqueRootedDagRoot(G g, URI root, WalkConstraint wc) throws SLIB_Ex_Critic { if (isDag(g, wc)) { Set<URI> roots = getDAGRoots(g, WalkConstraintUtils.getInverse(wc, false)); logger.debug("roots: " + roots); if (roots.size() == 1 && roots.iterator().next().equals(root)) { return true; } } return false; }
/** * Do not check if the graph is a DAG * * @param g * @param root * @param wc * @return true if the graph is a DAG and rooted by a unique vertex. * @throws SLIB_Ex_Critic */ public boolean isUniqueRootedDagRoot(G g, URI root, WalkConstraint wc) throws SLIB_Ex_Critic { if (isDag(g, wc)) { Set<URI> roots = getDAGRoots(g, WalkConstraintUtils.getInverse(wc, false)); logger.debug("roots: " + roots); if (roots.size() == 1 && roots.iterator().next().equals(root)) { return true; } } return false; }
/** * Do not check if the graph is a DAG * * @param g * @param root * @param wc * @return true if the graph is a DAG and rooted by a unique vertex. * @throws SLIB_Ex_Critic */ public boolean isUniqueRootedDagRoot(G g, URI root, WalkConstraint wc) throws SLIB_Ex_Critic { if (isDag(g, wc)) { Set<URI> roots = getDAGRoots(g, WalkConstraintUtils.getInverse(wc, false)); logger.debug("roots: " + roots); if (roots.size() == 1 && roots.iterator().next().equals(root)) { return true; } } return false; }
Set<URI> startingNodes = getDAGRoots(graph, WalkConstraintUtils.getInverse(wc, false));
Set<URI> startingNodes = getDAGRoots(graph, WalkConstraintUtils.getInverse(wc, false));
/** * Check if the underlying graph defined by given {@link WalkConstraint} is * a DAG. shortcut of {@link ValidatorDAG#isDag(G, WalkConstraint)} * considering the given edge types and the root vertices according to the * inverse of the specified edge types as root (see * {@link ValidatorDAG#getDAGRoots(G, WalkConstraint)}) * * @param graph the graph on which the evaluation has to be made * @param wc * @return true if the the (underlying) graph reduction is a DAG * * @throws SLIB_Ex_Critic */ public boolean isDag(G graph, WalkConstraint wc) throws SLIB_Ex_Critic { logger.debug("Check DAG property of the graph " + graph.getURI() + " considering the walkconstraint " + wc); Set<URI> startingNodes = getDAGRoots(graph, WalkConstraintUtils.getInverse(wc, false)); boolean isDag = false; logger.info("Starting process from " + startingNodes.size() + " vertices"); if (graph.getE().isEmpty()) { logger.info("No edge"); isDag = false; } else if (startingNodes.isEmpty()) { // No root No Dag logger.debug("No roots have been detected..."); logger.debug("DAG = false"); isDag = false; } else { isDag = isDag(graph, startingNodes, wc); } return isDag; }
Set<URI> startingNodes = getDAGRoots(graph, WalkConstraintUtils.getInverse(wc, false));
WalkConstraint wcOpp = WalkConstraintUtils.getInverse(wc, false); logger.debug("Building initial queue considering inverse constraint " + wcOpp);
WalkConstraint wcOpp = WalkConstraintUtils.getInverse(wc, false); logger.debug("Building initial queue considering inverse constraint " + wcOpp);
WalkConstraint wcOpp = WalkConstraintUtils.getInverse(wc, false); logger.debug("Building initial queue considering inverse constraint " + wcOpp);
WalkConstraint wcOpp = WalkConstraintUtils.getInverse(wc, false); logger.debug("Building initial queue considering inverse constraint " + wcOpp);
DFS dfs = new DFS(graph, roots, WalkConstraintUtils.getInverse(ancGetter.getWalkConstraint(), (false))); List<URI> topoOrdering = dfs.getTraversalOrder();
WalkConstraint oppositeWC = WalkConstraintUtils.getInverse(wc, false); logger.debug("Opposite Walk constraint " + oppositeWC);
WalkConstraint oppositeWC = WalkConstraintUtils.getInverse(wc, false); logger.debug("Opposite Walk constraint " + oppositeWC);
DFS dfs = new DFS(graph, roots, WalkConstraintUtils.getInverse(topNodeAccessor.getWalkConstraint(), (false))); List<URI> topoOrdering = dfs.getTraversalOrder();