當前位置: 首頁>>代碼示例>>Java>>正文


Java Direction.BOTH屬性代碼示例

本文整理匯總了Java中org.neo4j.graphdb.Direction.BOTH屬性的典型用法代碼示例。如果您正苦於以下問題:Java Direction.BOTH屬性的具體用法?Java Direction.BOTH怎麽用?Java Direction.BOTH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.neo4j.graphdb.Direction的用法示例。


在下文中一共展示了Direction.BOTH屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDirectionFrom

/**
    * Get the direction in which relationships are discovered using this
    * relationship pattern from the specified node. May be
    * {@link Direction#OUTGOING outgoing}, {@link Direction#INCOMING incoming},
    * or {@link Direction#BOTH both}.
    *
    * @param fromNode the pattern node to find the direction of this pattern
    *            relationship from.
    * @return the direction to discover relationships matching this pattern in.
    */
public Direction getDirectionFrom( PatternNode fromNode )
   {
       if ( !directed )
       {
           return Direction.BOTH;
       }
    if ( fromNode.equals( firstNode ) )
    {
    	return Direction.OUTGOING;
    }
    if ( fromNode.equals( secondNode ) )
    {
    	return Direction.INCOMING;
    }
    throw new RuntimeException( fromNode + " not in " + this );
   }
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:26,代碼來源:PatternRelationship.java

示例2: getSingleSourceShortestPath

public static SingleSourceShortestPath<Double> getSingleSourceShortestPath(RelationshipType relationshipType)
{
    return new SingleSourceShortestPathDijkstra<Double>( 0.0, null,
            new CostEvaluator<Double>()
            {
                public Double getCost( Relationship relationship,
                                       Direction direction )
                {
                    return 1.0;
                }
            }, new org.neo4j.graphalgo.impl.util.DoubleAdder(),
            new org.neo4j.graphalgo.impl.util.DoubleComparator(),
            Direction.BOTH, relationshipType );
}
 
開發者ID:maxdemarzi,項目名稱:graph_processing,代碼行數:14,代碼來源:Utils.java

示例3: shouldCalculateDegreeCentralityArrayStorageSPI

@Test
public void shouldCalculateDegreeCentralityArrayStorageSPI() throws IOException {
    DegreeArrayStorageParallelSPI degree = new DegreeArrayStorageParallelSPI(db, pool, Direction.BOTH);
    degree.compute("Person", "ACTED_IN", 1);
    long id = (long) TestUtils.getPersonEntry("Tom Hanks", db).get("id");
    assertTrue("outDegree Centrality calculted incorrectly", 12 == degree.getResult(id));
}
 
開發者ID:maxdemarzi,項目名稱:graph_processing,代碼行數:7,代碼來源:DegreeCentralityTest.java

示例4: buildString

@Override
void buildString( StringBuilder result )
{
    if ( direction != Direction.BOTH )
    {
        result.append( direction );
        result.append( ":" );
    }
    result.append( "*" );
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:10,代碼來源:StandardExpander.java

示例5: doExpand

@Override
Iterator<Relationship> doExpand( Node start )
{
    return direction == Direction.BOTH ?
            start.getRelationships().iterator() :
            start.getRelationships( direction ).iterator();
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:7,代碼來源:StandardExpander.java

示例6: add

@Override
public StandardExpander add( RelationshipType type, Direction direction )
{
    Direction excluded = exclusion.get( type.name() );
    final Map<String, Direction> newExclusion;
    if ( excluded == null )
    {
        return this;
    }
    else if ( excluded == direction || direction == Direction.BOTH )
    {
        if ( exclusion.size() == 1 )
        {
            return expander;
        }
        else
        {
            newExclusion = new HashMap<String, Direction>( exclusion );
            newExclusion.remove( type.name() );
        }
    }
    else
    {
        newExclusion = new HashMap<String, Direction>( exclusion );
        newExclusion.put( type.name(), direction.reverse() );
    }
    return new TypeLimitingExpander( expander, newExclusion );
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:28,代碼來源:StandardExpander.java

示例7: remove

@Override
public StandardExpander remove( RelationshipType type )
{
    Direction excluded = exclusion.get( type.name() );
    if ( excluded == Direction.BOTH )
    {
        return this;
    }
    Map<String, Direction> newExclusion = new HashMap<String, Direction>(
            exclusion );
    newExclusion.put( type.name(), Direction.BOTH );
    return new TypeLimitingExpander( expander, newExclusion );
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:13,代碼來源:StandardExpander.java

示例8: ConnectedComponents

public ConnectedComponents() {
	this.componentsMap = new Long2LongOpenHashMap();
	this.direction = Direction.BOTH;
}
 
開發者ID:besil,項目名稱:Neo4jSNA,代碼行數:4,代碼來源:ConnectedComponents.java

示例9: DirectedRelationshipType

public DirectedRelationshipType(RelationshipType type) {
  this(type, Direction.BOTH);
}
 
開發者ID:SciGraph,項目名稱:SciGraph,代碼行數:3,代碼來源:DirectedRelationshipType.java

示例10: ParallelCentralityTask

public ParallelCentralityTask(Set<Node> chunk,Set<Node> component, GraphDatabaseService graph, boolean eccentricityFlag, boolean betweennessFlag, boolean stressFlag, boolean avgSPFlag) {
	this.starts = chunk;
	this.graph = graph;
	

	RelationshipType[] types = null;
	try (Transaction tx = graph.beginTx()){

		types = Iterables.toArray(RelationshipType.class,GlobalGraphOperations.at(graph).getAllRelationshipTypes());
		tx.success();
	}

	SingleSourceShortestPath<Integer> sssPath = new SingleSourceShortestPathDijkstra<Integer>(0, null, new CostEvaluator<Integer>(){
		@Override
		public Integer getCost(Relationship relationship, Direction direction) {

			return new Integer(1);
		}
	}, new IntegerAdder(), new IntegerComparator(), Direction.BOTH, types);

	ppc = new LogParallelCentralityCalculation<Integer>(sssPath, chunk);

	if(eccentricityFlag){
		eccentricity = new Eccentricity2<Integer>( sssPath, 0,component, new IntegerComparator() );
		ppc.addCalculation(eccentricity);
	}

	if(betweennessFlag){
		betweennessCentrality = new BetweennessCentralityMulti<Integer>(sssPath, component );
		ppc.addCalculation(betweennessCentrality);
	}

	if(stressFlag){
		stressCentrality = new StressCentrality<Integer>(sssPath, component );
		ppc.addCalculation(stressCentrality);
	}

	if(avgSPFlag){
		avgSP = new AverageShortestPathMulti<Integer>(sssPath, component);
		ppc.addCalculation(avgSP);
	}

}
 
開發者ID:gsummer,項目名稱:neoNetworkAnalyzer,代碼行數:43,代碼來源:ParallelCentralityTask.java

示例11: hasNext

public boolean hasNext()
{
    if ( nextElement != null )
    {
        return true;
    }
    do
    {
        // if ( nextPosition < relIds.length )
        if ( relIds.hasNext() )
        {
            int nextId = relIds.next();
            try
            {
                Relationship possibleElement = nodeManager
                    .getRelationshipById( nextId );
                if ( direction == Direction.INCOMING
                    && possibleElement.getEndNode().equals( fromNode ) )
                {
                    nextElement = possibleElement;
                }
                else if ( direction == Direction.OUTGOING
                    && possibleElement.getStartNode().equals( fromNode ) )
                {
                    nextElement = possibleElement;
                }
                else if ( direction == Direction.BOTH )
                {
                    nextElement = possibleElement;
                }
            }
            catch ( Throwable t )
            {
                log.log( Level.FINE,
                    "Unable to get relationship " + nextId, t );
            }
        }
    }
    while ( nextElement == null && relIds.hasNext() );
    return nextElement != null;
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:41,代碼來源:RelationshipArrayIntSetIterator.java


注:本文中的org.neo4j.graphdb.Direction.BOTH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。