use graph_api_lib::{EdgeSearch, Graph, SupportsEdgeLabelIndex, SupportsVertexLabelIndex};
use graph_api_simplegraph::SimpleGraph;
use graph_api_test::{Edge, Vertex, populate_graph};
fn main() {
let mut graph = SimpleGraph::new();
let refs = populate_graph(&mut graph);
example(graph, refs.graph_api);
}
fn example<G>(graph: G, graph_api_id: G::VertexId)
where
G: Graph<Vertex = Vertex, Edge = Edge> + SupportsVertexLabelIndex + SupportsEdgeLabelIndex,
{
let creators = graph
.walk()
.vertices(Vertex::project())
.edges(Edge::created().incoming())
.head()
.collect::<Vec<_>>();
assert!(!creators.is_empty());
let connected_to_graph_api = graph
.walk()
.vertices_by_id(vec![graph_api_id])
.edges(EdgeSearch::scan().incoming())
.head()
.collect::<Vec<_>>();
assert!(!connected_to_graph_api.is_empty());
}