Calculation in Arbitrary Graphs
The Wiener index may be calculated directly using an algorithm for computing all pairwise distances in the graph. When the graph is unweighted (so the length of a path is just its number of edges), these distances may be calculated by repeating a breadth-first search algorithm, once for each starting vertex. The total time for this approach is O(nm), where n is the number of vertices in the graph and m is its number of edges.
For weighted graphs, one may instead use the Floyd–Warshall algorithm or Johnson's algorithm, with running time O(n3) or O(nm + n2 log n) respectively. Alternative but less efficient algorithms based on repeated matrix multiplication have also been developed within the chemical informatics literature.
Read more about this topic: Wiener Index
Famous quotes containing the words calculation and/or arbitrary:
“To my thinking boomed the Professor, begging the question as usual, the greatest triumph of the human mind was the calculation of Neptune from the observed vagaries of the orbit of Uranus.
And yours, said the P.B.”
—Samuel Beckett (19061989)
“A state that denies its citizens their basic rights becomes a danger to its neighbors as well: internal arbitrary rule will be reflected in arbitrary external relations. The suppression of public opinion, the abolition of public competition for power and its public exercise opens the way for the state power to arm itself in any way it sees fit.... A state that does not hesitate to lie to its own people will not hesitate to lie to other states.”
—Václav Havel (b. 1936)