E | Kantenmenge als -Matrix |
a | Index des Startknotens |
b | Index des Zielknotens |
w | Gewichtung der Kanten als -Vektor (optional) |
p | Liste der Knoten-Indize, welche den kürzesten Weg bilden |
s | Liste der Kanten-Indize, welche den kürzesten Weg bilden |
<html>
<head>
<script src="taramath.js"></script>
</head>
<body>
<div id="plot" style="display:inline-block;"></div>
<textarea id="output" style="width:300px; height:150px;"></textarea>
<script>
var E = [[3,4],[1,3],[1,2],[0,1],[2,3]];
var P = Graph.shortest_path(E, 0, 4);
Graph.plot("plot", E, "large", 300);
Print.init("output");
Print.set_digits(0);
Print.object("Knoten-Indize:");
Print.object(P.p);
Print.object("Kanten-Indize:");
Print.object(P.s);
</script>
</body>
</html>
xxxxxxxxxx
<html>
<head>
<script src="taramath.js"></script>
</head>
<body>
<div id="plot" style="display:inline-block;"></div>
<textarea id="output" style="width:300px; height:150px;"></textarea>
<script>
var G = Graph.random(12);
var P = Graph.shortest_path(G.E, 2, 11, G.w);
Graph.plot("plot", G.E, G.L, "large", 300);
Print.init("output");
Print.set_digits(0);
Print.object("Knoten-Indize:");
Print.object(P.p);
</script>
</body>
</html>