Spaces:
Sleeping
Sleeping
Commit History
-
app.py
Verified signatureimport os import subprocess def install(package): subprocess.check_call(["pip", "install", package]) # Manually install each required library install("numpy") install("networkx") install("matplotlib") install("gradio") import math import itertools import numpy as np import networkx as nx import matplotlib.pyplot as plt import gradio as gr # --- Topological Index Functions --- def wiener_index(graph): """ Wiener Index: Sum of shortest path distances between all pairs of vertices. """ sp = dict(nx.all_pairs_shortest_path_length(graph)) total = 0 for u in sp: for v in sp[u]: if u < v: total += sp[u][v] return total def compute_indices(graph, index_type): if index_type == "Wiener Index": return wiener_index(graph) elif index_type == "Randić Index": # Randić Index = Σ[1/√(d(u)*d(v))] for every edge (u,v) return sum(1 / math.sqrt(graph.degree(u) * graph.degree(v)) for u, v in graph.…efb736b
-
app.py
Verified signatureimport os import subprocess def install(package): subprocess.check_call(["pip", "install", package]) # Manually install each required library install("numpy") install("networkx") install("matplotlib") install("gradio") # Now import the installed libraries import math import itertools import numpy as np import networkx as nx import matplotlib.pyplot as plt import gradio as gr # --- Topological Index Functions --- def wiener_index(graph): """ Wiener Index: Sum of shortest path distances between all pairs of vertices. """ sp = dict(nx.all_pairs_shortest_path_length(graph)) total = 0 for u in sp: for v in sp[u]: if u < v: total += sp[u][v] return total def compute_indices(graph, index_type): if index_type == "Wiener Index": return wiener_index(graph) elif index_type == "Randić Index": # Randić Index = Σ[1/√(d(u)*d(v))] for every edge (u,v) return sum(1 / math.sqrt(graph.degree(u) …4dfd40a -
initial commit
Verified signaturec02efd4