Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

replace tabs with spaces in run.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,57 @@
import utils

def main():
# connect to GraphSpace
graphspace = GraphSpace('YOUR_EMAIL','YOUR_PASSWORD')
# connect to GraphSpace
graphspace = GraphSpace('YOUR_EMAIL','YOUR_PASSWORD')

# uncomment when you need it
#run_example(graphspace)
#run_yellowstone(graphspace)
#run_badgers(graphspace)
#run_example(graphspace)
#run_yellowstone(graphspace)
#run_badgers(graphspace)

return
return

## calculate and post centralities for UNWEIGHTED & WEIGHTED example graph.
def run_example(graphspace):
fname = 'example-edges.txt'
adj_list, edge_costs = utils.read_edges(fname)
fname = 'example-edges.txt'
adj_list, edge_costs = utils.read_edges(fname)

return
return

## calculate and post centralities for UNWEIGHTED yellowstone food web
def run_yellowstone(graphspace):
fname = 'yellowstone-edges.txt'
adj_list, edge_costs = utils.read_edges(fname)
fname = 'yellowstone-edges.txt'
adj_list, edge_costs = utils.read_edges(fname)

return
return

## calculate and post centralities for WEIGHTED badger graph
def run_badgers(graphspace):
fname = 'badger-edges.txt'
adj_list, edge_costs = utils.read_edges(fname)
fname = 'badger-edges.txt'
adj_list, edge_costs = utils.read_edges(fname)

return
return

## Start by copying shortest_paths() from Lab 3 and modify it.
def unweighted_shortest_paths(adj_list, n):
dist = None # this will be a dictionary of (node,dist from n) key-value pairs.
pi = None # this will be a dictionary of (node,predecessor) key-value pairs.

return dist, pi
return dist, pi

## Start by copying unweighted_shortest_paths() above and modify it.
def weighted_shortest_paths(edge_costs, n):
dist = None # this will be a dictionary of (node,dist from n) key-value pairs.
dist = None # this will be a dictionary of (node,dist from n) key-value pairs.
pi = None # this will be a dictionary of (node,predecessor) key-value pairs.

return dist, pi
return dist, pi

## get a dictionary of (node,betweenness_centrality) key-value pairs for all nodes in the graph.
## Handle the case where weighted = False and weighted = True.
def get_centralities(adj_list,edge_costs,weighted):
centralities = None # this will be a dictionary of (node,centrality) key-value pairs.

return centralities
return centralities

if __name__ == '__main__':
main()
main()