Finding Vertex with 1 Edge in Large Graph - Algorithm

AI Thread Summary
To efficiently identify vertices with at most one non-self edge in a large graph, one proposed algorithm involves first filtering out self-loops and multiple edges. The edges, represented as pairs of vertices, should be sorted alphabetically. By comparing the first letter of each edge with its adjacent edges, vertices that have a unique first letter in this context can be identified as having a degree of one in the simplified subgraph. While the suggestion is based on a basic understanding of programming, it emphasizes the need for a practical approach to coding, particularly in Python, to manipulate and analyze the data effectively. Further assistance could be provided if specific data examples or initial code attempts are shared.
brydustin
Messages
201
Reaction score
0
If I have a very large graph (set of edges and vertices, NOT the "picture/sketch" of the graph), what is a very efficient way to find all the vertices with only one edge attached to them. Most of the vertices will have many edges attached to them. Also any vertex may be connected to itself, and when we say that we want all vertices with only one edge we really mean all vertices with at most one non-self edge (i.e. may be connected to self and at most one other vertex).

I'm looking for some sort of computer algorithm to sort out a very large E=edge and V=vertex pair of sets.
 
Technology news on Phys.org
I am a terrible "programmer" with almost no formal training, so this is probably not the most efficient way.

I assume the edges are labeled by the vertices they're adjacent to (xy, xz, wz and so on). I'd remove any edges of the form xx, yy, and any multiple edges. Then, sort the list alphabetically, and compare the first letter of each edge to the edge above and below it. If both are different, that first letter of the edge is a vertex of degree 1 in the simple subgraph obtained, and thus is adjacent to only one other vertex.

That's the algorithm I'd use, anyway, if I had to do such a thing. But again, as I said, I'm not really a programmer, I just smash some code together when I have to on occasion. So, if my suggestion is not feasible, I apologize.
 
yeah...I would put together a short program (say, in python) and programmatically go through your data and pick the data of interest...

you know what your data looks like, so you should be able to pick it apart, too.

other than that, I don't know what exactly you are expecting from this thread without much info.

Go ahead and post a dozen lines from your data...take a shot at some code, post it, too...THEN, we may be able to help
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top