# Revision history [back]

### Does the set_embedding command have a bug?

We created a bipartite graph and called the set_embedding command by using a dictionary with vertices as keys and a list of neighboring vertices in clockwise order. The graph did not show the correct embedding. We expected the vertices to be in the correct clockwise order, but the order is not consistent. We also tried using the on_embedding command. Each time we run the code our vertices are randomly placed in different places.

### Does the set_embedding command have a bug?

We created a bipartite graph and called the set_embedding command by using a dictionary with vertices as keys and a list of neighboring vertices in clockwise order. The graph did not show the correct embedding. We expected the vertices to be in the correct clockwise order, but the order is not consistent. We also tried using the on_embedding command. Each time we run the code our vertices are randomly placed in different places.

EDIT:

# S0 and S1 are lists of lists

def Dessin(S0, S1):
numVertices = len(S0)+len(S1)

#creating dictionary G of vertices with neighboring edges in counterclockwise order
for i in range(numVertices):
G[i]=(S0+S1)[i]

verts[i]=[]
#iterate over black vertices
for i in range(len(S0)):
#iterate over edges connected to black vertices
for j in range(len(S0[i])):
#iterate over white vertices
for k in range(len(S1)):
#check if black and white vertices have an edge in common
if S0[i][j] in S1[k]:
#if they have an edge in common connect the vertices with the correct edge labeling

print('dictionary of neighboring edges:')
print(G)

#creating dictionary with vertices as keys and neighboring vertices in counterclockwise order
for i in range(numVertices):
for j in range(len(G[i])):
for k in range(numVertices):
if i!=k:
for l in range(len(G[k])):
if G[i][j] in G[k]:
if k not in verts[i]:
verts[i].append(k)
print("verts before flipped order:")
print(verts)

#flip order of vertices so that we're counterclockwise.
for i in range(len(verts)):
L=[]
for j in range(len(verts[i])):
L.append(verts[i][(len(verts[i]))-j-1])
verts[i]=L
graph.set_embedding(verts)


### Does the set_embedding command have a bug?

We created a bipartite graph and called the set_embedding command by using a dictionary with vertices as keys and a list of neighboring vertices in clockwise order. The graph did not show the correct embedding. We expected the vertices to be in the correct clockwise order, but the order is not consistent. We also tried using the on_embedding command. Each time we run the code our vertices are randomly placed in different places.

EDIT:

# S0 and S1 are lists of lists

def Dessin(S0, S1):
numVertices = len(S0)+len(S1)

#creating dictionary G of vertices with neighboring edges in counterclockwise order
for i in range(numVertices):
G[i]=(S0+S1)[i]

verts[i]=[]
#iterate over black vertices
for i in range(len(S0)):
#iterate over edges connected to black vertices
for j in range(len(S0[i])):
#iterate over white vertices
for k in range(len(S1)):
#check if black and white vertices have an edge in common
if S0[i][j] in S1[k]:
#if they have an edge in common connect the vertices with the correct edge labeling

print('dictionary of neighboring edges:')
print(G)

#creating dictionary with vertices as keys and neighboring vertices in counterclockwise order
for i in range(numVertices):
for j in range(len(G[i])):
for k in range(numVertices):
if i!=k:
for l in range(len(G[k])):
if G[i][j] in G[k]:
if k not in verts[i]:
verts[i].append(k)
print("verts before flipped order:")
print(verts)

#flip order of vertices so that we're counterclockwise.
for i in range(len(verts)):
L=[]
for j in range(len(verts[i])):
L.append(verts[i][(len(verts[i]))-j-1])
verts[i]=L
graph.set_embedding(verts)
graph.graphplot(edge_labels=True, vertex_colors={'black': color(S0,S1)[0],'white':color(S0,S1)[1]}, vertex_labels=False, edge_labels_background='transparent').show()


### Does the set_embedding command have a bug?

We created a bipartite graph and called the set_embedding command by using a dictionary with vertices as keys and a list of neighboring vertices in clockwise order. The graph did not show the correct embedding. We expected the vertices to be in the correct clockwise order, but the order is not consistent. We also tried using the on_embedding command. Each time we run the code our vertices are randomly placed in different places.

EDIT:

# S0 #S0 and S1 are lists of lists

 lists def Graf(S0, S1): D={} #empty graph G={} #edited graph that we add to verts={} #opening an empty graph graph=Graph(D, multiedges=True) #adds edges and vertices to the graph #S0 and S1 are lists of lists def Dessin(S0, S1): numVertices = len(S0)+len(S1) #creating dictionary G of vertices with neighboring edges in counterclockwise order for i in range(numVertices): G[i]=(S0+S1)[i] verts[i]=[] #iterate over black vertices for i in range(len(S0)): #iterate over edges connected to black vertices for j in range(len(S0[i])): #iterate over white vertices for k in range(len(S1)): #check if black and white vertices have an edge in common if S0[i][j] in S1[k]: #if they have an edge in common connect the vertices with the correct edge labeling graph.add_edge(i,k+len(S0),S0[i][j]) print('dictionary of neighboring edges:') print(G) #creating dictionary with vertices as keys and neighboring vertices in counterclockwise order for i in range(numVertices): for j in range(len(G[i])): for k in range(numVertices): if i!=k: for l in range(len(G[k])): if G[i][j] in G[k]: if k not in verts[i]: verts[i].append(k) print("verts before flipped order:") print(verts) #flip order of vertices so that we're counterclockwise. for i in range(len(verts)): L=[] for j in range(len(verts[i])): L.append(verts[i][(len(verts[i]))-j-1]) verts[i]=L #all the vertices in S0 are black, all the vertices in S1 are white def color(S0, S1): grey=[] white=[] for i in range(len(S0)): grey.append(i) for i in range(len(S1)): white.append(i+len(S0)) return [grey,white] #call and color the graph Dessin(S0, S1) color(S0, S1) print("verts after flipped order:") print(verts) #keep a certain ordering graph.set_embedding(verts) graph.graphplot(edge_labels=True, vertex_colors={'black': color(S0,S1)[0],'white':color(S0,S1)[1]}, vertex_labels=False, edge_labels_background='transparent').show() 





 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license. about | faq | help | privacy policy | terms of service Powered by Askbot version 0.7.56 Please note: Askbot requires javascript to work properly, please enable javascript in your browser, here is how //IE fix to hide the red margin var noscript = document.getElementsByTagName('noscript')[0]; noscript.style.padding = '0px'; noscript.style.backgroundColor = 'transparent'; askbot['urls']['mark_read_message'] = '/messages/markread/'; askbot['urls']['get_tags_by_wildcard'] = '/get-tags-by-wildcard/'; askbot['urls']['get_tag_list'] = '/get-tag-list/'; askbot['urls']['follow_user'] = '/followit/follow/user/{{userId}}/'; askbot['urls']['unfollow_user'] = '/followit/unfollow/user/{{userId}}/'; askbot['urls']['user_signin'] = '/account/signin/'; askbot['urls']['getEditor'] = '/get-editor/'; askbot['urls']['apiGetQuestions'] = '/api/get_questions/'; askbot['urls']['ask'] = '/questions/ask/'; askbot['urls']['questions'] = '/questions/'; askbot['settings']['groupsEnabled'] = false; askbot['settings']['static_url'] = '/m/'; askbot['settings']['minSearchWordLength'] = 4; askbot['settings']['mathjaxEnabled'] = true; askbot['settings']['sharingSuffixText'] = ''; askbot['settings']['errorPlacement'] = 'after-label'; askbot['data']['maxCommentLength'] = 800; askbot['settings']['editorType'] = 'markdown'; askbot['settings']['commentsEditorType'] = 'rich-text'; askbot['messages']['askYourQuestion'] = 'Ask Your Question'; askbot['messages']['questionSingular'] = 'question'; askbot['messages']['answerSingular'] = 'answer'; askbot['messages']['acceptOwnAnswer'] = 'accept or unaccept your own answer'; askbot['messages']['followQuestions'] = 'follow questions'; askbot['settings']['allowedUploadFileTypes'] = [ "jpg", "jpeg", "gif", "bmp", "png", "tiff" ]; askbot['data']['haveFlashNotifications'] = true; askbot['data']['activeTab'] = 'questions'; askbot['settings']['csrfCookieName'] = 'asksage_csrf'; askbot['data']['searchUrl'] = ''; /*<![CDATA[*/ $('.mceStatusbar').remove();//a hack to remove the tinyMCE status bar$(document).ready(function(){ // focus input on the search bar endcomment var activeTab = askbot['data']['activeTab']; if (inArray(activeTab, ['users', 'questions', 'tags', 'badges'])) { var searchInput = $('#keywords'); } else if (activeTab === 'ask') { var searchInput =$('#id_title'); } else { var searchInput = undefined; animateHashes(); } if (searchInput) { searchInput.focus(); putCursorAtEnd(searchInput); } var haveFullTextSearchTab = inArray(activeTab, ['questions', 'badges', 'ask']); var haveUserProfilePage = $('body').hasClass('user-profile-page'); if ((haveUserProfilePage || haveFullTextSearchTab) && searchInput && searchInput.length) { var search = new FullTextSearch(); askbot['controllers'] = askbot['controllers'] || {}; askbot['controllers']['fullTextSearch'] = search; search.setSearchUrl(askbot['data']['searchUrl']); if (activeTab === 'ask') { search.setAskButtonEnabled(false); } search.decorate(searchInput); } else if (activeTab === 'tags') { var search = new TagSearch(); search.decorate(searchInput); } if (askbot['data']['userIsAdminOrMod']) {$('body').addClass('admin'); } if (askbot['settings']['groupsEnabled']) { askbot['urls']['add_group'] = "/add-group/"; var group_dropdown = new GroupDropdown(); $('.groups-dropdown').append(group_dropdown.getElement()); } var userRep =$('#userToolsNav .reputation'); if (userRep.length) { var showPermsTrigger = new ShowPermsTrigger(); showPermsTrigger.decorate(userRep); } }); if (askbot['data']['haveFlashNotifications']) { $('#validate_email_alert').click(function(){notify.close(true)}) notify.show(); } var langNav =$('.lang-nav'); if (langNav.length) { var nav = new LangNav(); nav.decorate(langNav); } /*]]>*/ if (typeof MathJax != 'undefined') { MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], tex2jax: {inlineMath: [["$","$"],["\$","\$"]]} }); } else { console.log('Could not load MathJax'); } var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker('UA-61392941-1'); pageTracker._trackPageview(); } catch(err) {} //todo - take this out into .js file $(document).ready(function(){$('div.revision div[id^=rev-header-]').bind('click', function(){ var revId = this.id.substr(11); toggleRev(revId); }); lanai.highlightSyntax(); }); function toggleRev(id) { var arrow = $("#rev-arrow-" + id); var visible = arrow.attr("src").indexOf("hide") > -1; if (visible) { var image_path = '/m/default/media/images/expander-arrow-show.gif?v=19'; } else { var image_path = '/m/default/media/images/expander-arrow-hide.gif?v=19'; } image_path = image_path + "?v=19"; arrow.attr("src", image_path);$("#rev-body-" + id).slideToggle("fast"); } for (url_name in askbot['urls']){ askbot['urls'][url_name] = cleanUrl(askbot['urls'][url_name]); }