To find the detour distance (longest simple path) between every pair of vertices in a molecular graph .
If I'm not misunderstanding, you may use NetworkX to do that.
For a simple example.
First, create an undirected graph.
G = nx.Graph()
Then you can add some edges,
G.add_edge('A', 'B')
G.add_edge('B', 'C')
G.add_edge('C', 'D')
G.add_edge('D', 'E')
G.add_edge('E', 'F')
Then we can define a function to get two edges v1 and v2.
def detour_distance(graph, v1, v2):
we can use nx.all_pairs_shortest_path_length() to find all path among all edges.
all_simple_paths = list(nx.all_simple_paths(graph, v1, v2))
Then calculate the length of every path(edge num, use 1 as default)
all_path_lengths = [len(path) - 1 for path in all_simple_paths]
Return the maximum path length
return max(all_path_lengths)
print(detour_distance(G, 'A', 'E')) # 4
print(detour_distance(G, 'A', 'B')) # 1
you may ask Yiren Wang he's professional.
Correct me if any wrong.
I want to know more about Uranium ore deposits in world.
11 August 2024 6,718 0 View
I want to know more about diamond ore deposits in world.
11 August 2024 2,166 1 View
If Banks do not provide credit facility, what are the options available for FPOs and impact on producer’s income?
10 August 2024 8,197 5 View
We assume that the difference is huge and that it is not possible to compare the two spaces. The R^4 mathematical space considers time as an external controller and the space itself is immobile in...
10 August 2024 6,676 14 View
What are a “Farmers Producer Organization” (FPO) and its essential features?
10 August 2024 475 5 View
I used eye tracking to examine how participants from two different populations (A and B) react to an image. Participants in population A exhibit larger pupil sizes over time, but they also have...
10 August 2024 3,226 0 View
I have been doing the m6A dot blot for a while with no improvement, I am extracting the RNA, and I can see the dots although the three biological replicas give a different reading on the memberan...
10 August 2024 8,537 5 View
How do interactions between the biosphere, the carbon cycle, and the water cycle impact global warming and interaction between the atmosphere and the hydrosphere?
09 August 2024 3,286 2 View
I have input a moment load in module load Abaqus, i put my moment load on the node surface (using reference point). I have define moment in history output and make a set for moment too. But the...
08 August 2024 4,829 4 View
How is energy cycled through the Earth's climate system and how do matter cycle and energy flow through the rock cycle?
08 August 2024 8,159 0 View
I'm currently exploring the application of Python in textile engineering, specifically in areas like data analysis, process automation, and the development of smart textiles. I'm interested in...
10 August 2024 7,427 2 View
I need to model an anisotropic material in which the Poisson's ratio ν_12 ≠ ν_21 and so on. Therefore, the elastic compliance matrix wouldn't be a symmetric one. In ANSYS APDL, for TB,ANEL...
09 August 2024 5,047 2 View
Request Python code from this article : Gender equity of authorship in pulmonary medicine over the past decade. THANKS!
08 August 2024 6,241 2 View
Visual Studio Code (VS Code) has become a popular choice among developers for several reasons: 1. **Free and Open Source**: VS Code is free to use and open source, making it accessible to...
07 August 2024 7,010 4 View
I received an e-mail invitation to join the editorial board of Clinical Cardiology Updates. While I have published a few articles related to cardiovascular disease, there are lots of colleagues...
06 August 2024 8,980 8 View
I need the python code to forecast what crop production will be in the next decade considering climate and crop production variables as seen in the attached.csv file.
05 August 2024 2,976 3 View
Hello everyone, I am currently working on a research project that aims to integrate machine learning techniques into an open source SIEM tool to automate the creation of security use cases from...
04 August 2024 3,192 2 View
I got comment on my FTIR data figure from a reviewer. The reviewer said "FTIR data in Figure should be repeated. there is no bassline." I made Y off set comparison graph of FTIR on OriginLab. Can...
03 August 2024 6,069 3 View
I have used Prussian blue nanoparticles as a redox couple. The PBNPs have been made using only one salt precursor. Also, during scan rate studies, a small oxidation peak can be consistently found...
31 July 2024 9,697 0 View
The entropy measured of molecular graphs plays a crucial rule. The network structures in some cases are very lengthy calculations to handle. Some author avoid to construct table where as most...
30 July 2024 3,125 0 View