I need to show a specific vertex with IN edges and related vertex.
I tried with this but I don't have a graph
%%gremlin -p v-d,oute,inv, -d name g.V().has('name','my_value').outE().inV().path().by(elementMap())
how can I modify my command?
For example, I have created this graph
vertex OUT
Now I want to show INCOMING edges and vertexs for a specific vertex
The visualization will be for the path created in the query. You cannot expand an existing visualization currently. So to see the incoming edges you will need to either add that to the current query or create a new one that contains inE and outV steps
Related
While mapping a relational OO model, I came across a scenario wherein it is required to maintain a One-to-One relation between vertices.
Is it possible to restrict the cardinality of edges using labels in AWS Neptune the way it is done from Vertex Properties?
Well, this would be quite helpful when there is an update in the relationship.
As it stands today, the only constraints for Property Graph provided by Neptune include:
Each vertex/edge must have a unique ID that is global to the full set of vertices and the full set of edges. IDs can be any string value.
Each vertex and edge must have a label. If you don't supply one, a vertex is given a label of "vertex" and an edge is given a label of "edge".
Properties on vertices can be either sets or of single cardinality. Edge properties, on the other hand, can only be of single cardinality.
I am wondering if there is a vtk filter that replaces glyps (cone source) with a single vertex?
Here is the problem i am trying to solve. I have bunch of vector field data displayed using cone glyps. I am trying to pick a vector glyph and display vector values. I am using vtkCellPicker to pick the vector glyph. The cell picker is picking the face on the glyph instead of picking the whole glyph. So, the vector values picked are values on the face, not for the entire glyph.
If i can run the vtkData through some filter which replaces these glyps with a single vertex, i can pick the point and pick the correct vector field values.
Any help is appreciated.
You can use a vtkPolyDataConnectivityFilter (http://www.vtk.org/doc/nightly/html/classvtkPolyDataConnectivityFilter.html#details) to pull out the whole glyph starting from the one cell that is picked.
You may be better off setting GeneratePointIdsOn on your vtkGlyph3D filter which will add to the cone data an extra array with input point IDs. You can then use this to look up the original data value for display. See http://www.vtk.org/doc/nightly/html/classvtkGlyph3D.html#a1d7bfd7779ca2e229423a33a2e36e741
I am trying to use OGDF to perform some processing on graphs loaded from GML files. These graphs are only meaningful if the node labels are maintained. Unfortunately, OGDF does not make it easy to keep node attributes like labels, since they are maintained in a separate data structure called GraphAttributes. My problem is that GraphAttributes associates node labels with node indices, which are not maintained by some of the graph transformations I need to use.
One of the transformations I need to perform on the Graphs is to split up each connected subgraph in a GML file. Loading the graph and its node labels is simple:
ogdf::Graph graph;
ogdf::GraphAttributes attributes(graph, ogdf::GraphAttributes::nodeLabel);
ogdf::GraphIO::readGML(attributes, graph, FILENAME);
// this gives the correct label of the first node in the graph
attributes.label(graph.firstNode());
Similarly, OGDF provide the CCsInfo class to find the connected subgraphs of a graph. Since, I want to work with these subgraphs independently, I use the GraphCopy::initByCC method to create separate Graph instances.
ogdf::CCsInfo info(graph);
ogdf::GraphCopy copy(graph);
ogdf::EdgeArray< ogdf::edge > edgeArray(graph);
// where i (int) is the number of the connected subgraph to copy
copy.initByCC(info, i, edgeArray);
// this now gives the wrong label for the first node in copy
attributes.label(copy.firstNode());
This works, and copy contains only the nodes and edges of the connected subgraph. However, the indices of the nodes in the copy are different from the indices of the nodes in the original graph. This means that the mapping of labels to nodes in the attributes object do not apply to the nodes in copy.
Is there a way to perform the same transformation on the attributes object so that I can get the correct labels for the nodes in the copied connected subgraph?
It turns out this isn't as difficult as I thought. The key piece I was missing is that you can use the GraphCopy::original method to get the node with the index from the original graph and then use that node to get the label.
// get the correct label for the first node of the GraphCopy object copy
attributes.label(copy.original(copy.firstNode()));
I am using BGL recently, and I have a graph G now. I need a data structure that can rule out one vertex at a time, without breaking the original graph. What should I do?
At first I found the filtered graph, but I need to label all vertices, and create a new filtered graph after I rule out a vertex. If I have N vertices in the graph, I need to filter N times.
I also thought of a subgraph, but it doesn't support removing vertices.
You can use a filtered graph.
You can have a dynamic filter predicate that incrementally filters out more vertices. No need to create more filtered graphs at all.
See an example:
Using two objects as hash key for an unordered_map or alternatives
boost graph copy and removing vertex
Remove 100,000+ nodes from a Boost graph
I have a set of edges from a graph, and would like to expand it with all edges that share a vertex with any edge. How could I do this efficiently with boost::graphs?
The only way I've been able to come up with is the naive solution of extracting all the source and target vertices, using boost::adjacent_vertices to get all adjacencies and then creating all the new edges with boost::edge. Is there a better way of doing this?
Context: The graph vertices are centroids of a terrain triangulation, the edges connect vertices whose corresponding triangles are adjacent (so sort of a dual graph). The set of edges I'm looking to expand corresponds to inter-triangle paths which are blocked, and the blocked area is expanding. The area is sort-of circular, so most of the edges I'll see using my naive approach above will already be part of the set.
Instead of considering all adjacent vertices in each step to generate the new edges, use a property map to mark edges already encounterd. Thus, you need to consider unmarked edges in each step only. A vertex is marked after adding all edges incident to it to your set.
Given the fact that the internal data structure used by boost::graph is either an adjacency list or an adjacency matrix, I do not think that any further improvement is possible.