本文整理匯總了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 );
}
示例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 );
}
示例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));
}
示例4: buildString
@Override
void buildString( StringBuilder result )
{
if ( direction != Direction.BOTH )
{
result.append( direction );
result.append( ":" );
}
result.append( "*" );
}
示例5: doExpand
@Override
Iterator<Relationship> doExpand( Node start )
{
return direction == Direction.BOTH ?
start.getRelationships().iterator() :
start.getRelationships( direction ).iterator();
}
示例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 );
}
示例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 );
}
示例8: ConnectedComponents
public ConnectedComponents() {
this.componentsMap = new Long2LongOpenHashMap();
this.direction = Direction.BOTH;
}
示例9: DirectedRelationshipType
public DirectedRelationshipType(RelationshipType type) {
this(type, Direction.BOTH);
}
示例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);
}
}
示例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;
}