Closed math1um closed 3 years ago
The above code is mysteriously "flattened out" by the github editor!!!!
def is_v_twin(g,v): #for each neighbor w of v, check if N[v]=N[w] Nv=g.neighbors(v) Nvp=Nv+[v] for w in Nv: Nw=g.neighbors(w) Nw.append(w) if Set(Nvp) == Set(Nw): return True return False
def has_twin(g): #True if there are vertices v,w with N[v]=N[w] for v in g.vertices(): if is_v_twin(g,v): return True return False
def is_twin_free(g): #True if there are no vertices v,w with N[v]=N[w] return not has_twin(g)
bad luck!
You need to use three ` marks, not just one.
#trying again to have code properly indented
def is_v_twin(g,v): #for each neighbor w of v, check if N[v]=N[w]
Nv=g.neighbors(v)
Nvp=Nv+[v]
for w in Nv:
Nw=g.neighbors(w)
Nw.append(w)
if Set(Nvp) == Set(Nw):
return True
return False
def has_twin(g): #True if there are vertices v,w with N[v]=N[w]
for v in g.vertices():
if is_v_twin(g,v):
return True
return False
def is_twin_free(g): #True if there are no vertices v,w with N[v]=N[w]
return not has_twin(g)
thanks. amazingly hitting the "code" button in the editor gives you a single quote mark - and its not enough to leave the code indented. so dumb!
On Thu, Jul 8, 2021 at 3:31 PM Nico Van Cleemput @.***> wrote:
You need to use three ` marks, not just one
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/math1um/objects-invariants-properties/issues/634#issuecomment-876690416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQFIXHZHQJKMVX5UUPSZE3TWX4IHANCNFSM5ABAJ3LQ .
--
CELarson Web: https://www.people.vcu.edu/~clarson http://www.people.vcu.edu/~clarson
Automated Conjecturing for Sage: https://nvcleemp.github.io/conjecturing/ http://nvcleemp.github.io/conjecturing/
Graph Brain Project: https://github.com/math1um/objects-invariants-properties
VCU Discrete Math Seminar: https://go.vcu.edu/discrete http://www.people.vcu.edu/~nobushaw/dms.html
Craig Larson, Professor Department of Mathematics and Applied Mathematics Virginia Commonwealth University
4106 Grace E. Harris Hall 1015 Floyd Avenue Richmond, VA 23284-2014
Yes, a single quote mark is for formatting a single line of text with a code-like font like this
. For multiple lines of code you need to use the triple quote mark.
added to properties