# Finding Common Vertices

What I wish to do is find different length loops that do not share the same vertex. These loop are found on the same graph. I'm also trying to find all the loops with the same length in the graph.

• have you seen FindCycle? – george2079 Nov 21 '16 at 21:07

Question 2

The general solution for your second question should be clear from this example:

myGraph = RandomGraph[{20, 50}]

FindCycle[myGraph, {3}, All]


Question 1

threelist = FindCycle[myGraph, {3}, All]


Gives a list of all cycles of length 3.

VertexList /@ %


Gives the vertexes in these cycles.

Likewise for

fourlist = FindCycle[myGraph, {4}, All]


Then just search for pairs of lists that do not contain the same element.

But are you sure you've asked the question as you truly intend? This is a very funny question ("find different length loops that do not share the same vertex").

• Ok I guess I wasn't clear with my question the issue is more complicate than this. I want a looping function that allows me to add the one or more disjunct cycles that equal a length of n (n going from 1 to number of vertices) and in the end I want put these values into another equation that will be a test or else it creates a new graph. – Wilco Nov 24 '16 at 17:02
• If you want to be clear, start by using proper grammar and punctuation. Your first sentence is ungrammatical because it lacks basic punctuation. Then eliminate useless words, such as "that allows me." Then avoid ambiguity... "allows me to add..." add to what? Whenever possible, give an example. Your question is is still quite unclear. (By the way, I used to be a professor of mathematics at a major university, so I don't think it is that I and other answerers are simply dim here.) – David G. Stork Nov 26 '16 at 2:36
• The formula I'm trying to figure out is Sigma(-1)^(k-m)L(m,k). Where L(m,k) is a product of m disjunct loops totalling up to k elements. The maximum of k is the number of vertices in the graph (which is pre-created). – Wilco Nov 28 '16 at 19:30
• I should also state that I'm trying to find these disjunct loops and add them (the loops) together if those loops elements added up are equal to the value of k. Also, I have values for each connection between vertices (this should not be confused with elements), that I'd wish to be able to pull out and add together. – Wilco Nov 28 '16 at 19:45
• If I'm still confusing for you to read and understand, I do have a source of the formula: THE QUALITATIVE ANALYSIS OF PARTIALLY Specified Systems Richard Levins 1974. Also quite frankly, I don't care who you are I find the tone that you used in your response abhorrent, especially since English is my second language. I would also like to point out that, I never called someone "dim" or thought they were dim. – Wilco Nov 28 '16 at 19:50