Ask Your Question
1

Edges associated to the variables in G.kirchhoff_symanzik_polynomial()

asked 2016-11-16 13:05:38 +0200

pm gravatar image

How do the variables t0, t1, t2,... in G.kirchhoff_symanzik_polynomial(), for a given undirected graph G, correspond to the edges of G? (i.e. what is the bijection between the variables ti and the edges of G?) The variables do not follow the same order as in the list G.edges(), which I thought was the case.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-16 18:05:37 +0200

tmonteil gravatar image

Looking at the source code of the method (see G.kirchhoff_symanzik_polynomial??), you see that the following dictionary is used to map integers to edges:

edge2int = {e: j for j, e in enumerate(edges)}

Hence, you can get the correspondence integer -> edges by just typing:

sage: {j: e for j, e in enumerate(G.edges())}

Note however that this behaviour is read from the current source code, but it is not specified in the documentation, so while it is the case now, it might change in the future without warning, so be careful (or request an explicit specification).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-11-16 13:05:38 +0200

Seen: 215 times

Last updated: Nov 16 '16