Skip to content

Commit

Permalink
Adjacency matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
PyMap committed Aug 23, 2021
1 parent 394cb23 commit dd14d3b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pandana/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ def reindex(series1, series2):
right_index=True,
how="left")
return df.right

def adjacency_matrix(edges_df, plot_matrix=False):
df = pd.crosstab(edges_df['from'], edges_df['to'])
idx = df.columns.union(df.index)
df = df.reindex(index = idx, columns=idx, fill_value=0)

return df

0 comments on commit dd14d3b

Please sign in to comment.