Java 类org.neo4j.graphdb.PathExpander 实例源码

项目:NeoDD    文件:Problem.java   
public double correlate(Node source, Node target, RelationshipType type, Direction dir, Object... more) {
    if (null == source)
        throw new IllegalArgumentException("Illegal 'source' argument in Problem.correlate(Node, Node, RelationshipType, Direction, Object...): " + source);
    if (null == target)
        throw new IllegalArgumentException("Illegal 'target' argument in Problem.correlate(Node, Node, RelationshipType, Direction, Object...): " + target);
    if (null == type)
        throw new IllegalArgumentException("Illegal 'type' argument in Problem.correlate(Node, Node, RelationshipType, Direction, Object...): " + type);
    if (null == dir)
        throw new IllegalArgumentException("Illegal 'dir' argument in Problem.correlate(Node, Node, RelationshipType, Direction, Object...): " + dir);
    if (source.equals(target))
        return 1.0;
    try (Transaction ignore = graph.beginTx()) {
        PathExpander<Object> expander = null;
        if (null == more || 0 == more.length)
            expander = PathExpanders.forTypeAndDirection(type, dir);
        else {
            RelationshipType t = (RelationshipType) more[0];
            Direction d = (Direction) more[1];
            expander = PathExpanders.forTypesAndDirections(type, dir, t, d, Arrays.copyOfRange(more, 2, more.length));
        }
        PathFinder<Path> finder = GraphAlgoFactory.allPaths(expander, 1 + count);
        Iterable<Path> paths = finder.findAllPaths(source, target);

        Set<Relationship> relationships = new HashSet<>();
        Set<Set<Relationship>> expression = new HashSet<>();
        for (Path path : paths) {
            Set<Relationship> item = new HashSet<>();
            for (Relationship relationship : path.relationships()) {
                relationships.add(relationship);
                item.add(relationship);
            }
            expression.add(item);
        }

        BDD bdd = new BDD(expression, relationships);
        bdd.dump("bdd.gv");
        return bdd.traverse();
    }
}
项目:cypher_hip_hop    文件:HipHopExpander.java   
@Override
public PathExpander reverse() {
    return null;
}
项目:dnainator    文件:TopologicalPathExpander.java   
@Override
public PathExpander<PrimitiveLongSet> reverse() {
    throw new UnsupportedOperationException();
}
项目:SciGraph    文件:DirectionalPathExpander.java   
@Override
public PathExpander<Void> reverse() {
  return null;
}
项目:obelix    文件:TimeStampExpander.java   
@Override
public final PathExpander reverse() {
    return this;
}
项目:steps    文件:StepsExpander.java   
@Override
public PathExpander<StepState> reverse()
{
    // TODO deal with this in better way
    throw new UnsupportedOperationException( "reverse not implemented by " + getClass().getSimpleName() );
}
项目:steps    文件:StepsExpander.java   
@Override
public PathExpander<StepState> reverse()
{
    // TODO deal with this in better way
    throw new UnsupportedOperationException( "reverse not implemented by " + getClass().getSimpleName() );
}
项目:checklistbank    文件:TaxonomicOrderExpander.java   
@Override
public PathExpander reverse() {
  throw new UnsupportedOperationException();
}