Graphx :Edit the graph and add the vertex and Edges - scala

I'm new to Graphx and doing some research, where I have to map the property graph model to hadoop. I have successfully created the graph by creating Vertex and edge RDD.Now I want to edit my graph by adding vertex at position X and the add a edge at position X-1 and X+1.
I have read multiple documents which says graphs are immutable, but there is an option of subgraph but according to me it is used only to eliminate certain vertex and edges.
Can some one guide me is there any way to edit the graphs ?

Related

three.js calculate surfaces of stl files

I think i have a difficult problem right here..
I want to able to get the surfaces of f.e. the orange object in this three.js example https://threejs.org/examples/?q=stl#webgl_loader_stl
i want to click with the mouse, find the correct surface, which should then be highlighted, so i make sure this was the surface i want.
(i already implemented raycaster successfully, so thats not an issue)
The intersectObject method returns an array of intersections, each of which has face property. The face contains vertex indices.
For STL files containing multiple solids, each solid is assigned to a different group, and the groups are available in the geometry object that is returned from STLLoader. Each group is defined by a range of vertex indices.
So, I think you can correlate the vertex indices returned from the raycaster with the vertex indices in the geometry groups.

How to get vertex neighbors in Unity

I am trying to create an advanced shader for an AR application in Unity. Therefore I need all vertices and their neighbors from my gameobject (within a C# script). Getting the vertices is not the problem, but how do I get their neighbors(maybe with an indexbuffer)?
I am not new to shaders, but to shaders within Unity.
After I got the neighbors I would like to pass them from a C# script to a function within a shader file. I guess that should be possible in Unity, is it not?
The easiest way I can think of is by searching the triangle index. The pattern is always the same, always 3 indices define a vertex. since you know the index of your vertex, you can just search the triangle array and return the other two of any triangle, which will give you all vertices within the range of the desired one.

Can we use NetworkX package for finding subgraphs that are associated with a selected set of vertices?

the nodes in blue color are the selected set of vertices..we are trying to find out the subgraphs associated with these selected set of vertices
expected frequent subgraph, where source vertex is one of the selected vertex

How to determine the source vertex of connected component in graphx

I'm trying to determine the source vertex (root) in each connected component. The Graphx documentation says the connected components algorithm labels each connected component of the graph with the ID of its lowest-numbered vertex.
I would like to retrieve the source vertex, in this case 11. How can I do that?

Gremlin: otherV() not working inside order().by()

I'm using Tinkerpop 3.0.1 (Titan 1.0.0), and I try to list all edges for a vertex, sorted by degree of the node on the other end of the edge.
I tried:
g.V(1482896).bothE().order().by(otherV().bothE().count(), decr)
I get the following error from Titan:
The path history of the traverser does not contain a previous vertex: [e[1d2m8u-1d70ts-b2t-vs7k][82628848-DIRECTED->1482896]]
The strange thing is, there is a previous vertex in the path (namely vertex #1482896. I'm confused on how to solve this one.
Answering my own question, after playing around with this, I found a workaround:
g.V(123).bothE().as('edges')
.otherV().order().by(bothE().count(), decr)
.select('edges')
This will effectively sort edges adjacent to vertex #123 by highest degree of the node on the other end of the edge.