Ask Your Question
0

How to see the source code of the function distance_graph

asked 2024-03-17 06:11:55 +0100

licheng gravatar image

updated 2024-03-17 08:26:17 +0100

I noticed the documentation for the distance_graph function, and I wanted to view its source code. However, when I tried to run ? graphs.distance_graph, it didn't work.

So, I searched for it on Sage's GitHub repository. I came across this line: :meth:sage.graphs.generic_graph.distance_graph for diameter distance. However, I still couldn't find the relevant description in the file sage.graphs.generic_graph. Or running ? graphs.generic_graph.distance_graph also does not work.

How can I locate its implementation?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2024-03-17 10:22:32 +0100

rburing gravatar image

That hardcoded reference in the documentation seems to be outdated. The following work:

sage: sage.graphs.graph.Graph.distance_graph??
sage: Graph.distance_graph??
sage: G = Graph([(0,1)])
sage: G.distance_graph??

To find the file/module:

sage: search_src("distance_graph")
edit flag offensive delete link more

Comments

Oops !! sorry. Thank you @rburing.

ortollj gravatar imageortollj ( 2024-03-17 10:25:07 +0100 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-03-17 06:11:55 +0100

Seen: 250 times

Last updated: Mar 17