GetAdjacentIds

See javadoc - uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds

Available since Gaffer version 1.0.0

Performs a single hop down related edges

Required fields

No required fields

Examples

Get adjacent ids from vertex 2

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final GetAdjacentIds operation = new GetAdjacentIds.Builder()
        .input(new EntitySeed(2))
        .build();
{
  "class" : "GetAdjacentIds",
  "input" : [ {
    "class" : "EntitySeed",
    "vertex" : 2
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds",
  "input" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 2
  } ]
}
g.GetAdjacentIds( 
  input=[ 
    g.EntitySeed( 
      vertex=2 
    ) 
  ] 
)

Result:

Java
JSON
EntitySeed[vertex=4]
EntitySeed[vertex=3]
EntitySeed[vertex=1]
EntitySeed[vertex=5]
[ {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 4
}, {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 3
}, {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 1
}, {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 5
} ]


Get adjacent ids along outbound edges from vertex 2

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final GetAdjacentIds operation = new GetAdjacentIds.Builder()
        .input(new EntitySeed(2))
        .inOutType(IncludeIncomingOutgoingType.OUTGOING)
        .build();
{
  "class" : "GetAdjacentIds",
  "input" : [ {
    "class" : "EntitySeed",
    "vertex" : 2
  } ],
  "includeIncomingOutGoing" : "OUTGOING"
}
{
  "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds",
  "input" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 2
  } ],
  "includeIncomingOutGoing" : "OUTGOING"
}
g.GetAdjacentIds( 
  input=[ 
    g.EntitySeed( 
      vertex=2 
    ) 
  ], 
  include_incoming_out_going="OUTGOING" 
)

Result:

Java
JSON
EntitySeed[vertex=4]
EntitySeed[vertex=3]
EntitySeed[vertex=5]
[ {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 4
}, {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 3
}, {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 5
} ]


Get adjacent ids along outbound edges from vertex 2 with count greater than 1

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final GetAdjacentIds operation = new GetAdjacentIds.Builder()
        .input(new EntitySeed(2))
        .inOutType(IncludeIncomingOutgoingType.OUTGOING)
        .view(new View.Builder()
                .edge("edge", new ViewElementDefinition.Builder()
                        .preAggregationFilter(new ElementFilter.Builder()
                                .select("count")
                                .execute(new IsMoreThan(1))
                                .build())
                        .build())
                .build())
        .build();
{
  "class" : "GetAdjacentIds",
  "input" : [ {
    "class" : "EntitySeed",
    "vertex" : 2
  } ],
  "view" : {
    "edges" : {
      "edge" : {
        "preAggregationFilterFunctions" : [ {
          "selection" : [ "count" ],
          "predicate" : {
            "class" : "IsMoreThan",
            "orEqualTo" : false,
            "value" : 1
          }
        } ]
      }
    }
  },
  "includeIncomingOutGoing" : "OUTGOING"
}
{
  "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds",
  "input" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 2
  } ],
  "view" : {
    "edges" : {
      "edge" : {
        "preAggregationFilterFunctions" : [ {
          "selection" : [ "count" ],
          "predicate" : {
            "class" : "uk.gov.gchq.koryphe.impl.predicate.IsMoreThan",
            "orEqualTo" : false,
            "value" : 1
          }
        } ]
      }
    }
  },
  "includeIncomingOutGoing" : "OUTGOING"
}
g.GetAdjacentIds( 
  view=g.View( 
    edges=[ 
      g.ElementDefinition( 
        group="edge", 
        pre_aggregation_filter_functions=[ 
          g.PredicateContext( 
            selection=[ 
              "count" 
            ], 
            predicate=g.IsMoreThan( 
              value=1, 
              or_equal_to=False 
            ) 
          ) 
        ] 
      ) 
    ], 
    all_edges=False, 
    all_entities=False 
  ), 
  input=[ 
    g.EntitySeed( 
      vertex=2 
    ) 
  ], 
  include_incoming_out_going="OUTGOING" 
)

Result:

Java
JSON
EntitySeed[vertex=3]
[ {
  "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
  "vertex" : 3
} ]


results matching ""

    No results matching ""