Skip to content

Commit

Permalink
Remove NetworkModule_sigma and its dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rht authored and tpike3 committed Apr 9, 2022
1 parent 7ef89db commit e549107
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def network_portrayal(G):
return portrayal


grid = NetworkModule(network_portrayal, 500, 500, library="sigma")
grid = NetworkModule(network_portrayal, 500, 500)
chart = ChartModule(
[{"Label": "Gini", "Color": "Black"}], data_collector_name="datacollector"
)
Expand Down
2 changes: 1 addition & 1 deletion examples/virus_on_network/virus_on_network/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_agents(source, target):
return portrayal


network = NetworkModule(network_portrayal, 500, 500, library="d3")
network = NetworkModule(network_portrayal, 500, 500)
chart = ChartModule(
[
{"Label": "Infected", "Color": "#FF0000"},
Expand Down
19 changes: 6 additions & 13 deletions mesa/visualization/modules/NetworkVisualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Network Visualization Module
============
Module for rendering the network, using [sigma.js](http://sigmajs.org/) or [d3.js](https://d3js.org/) frameworks.
Module for rendering the network, using [d3.js](https://d3js.org/) framework.
"""
from mesa.visualization.ModularVisualization import VisualizationElement, D3_JS_FILE
Expand All @@ -12,19 +12,12 @@ class NetworkModule(VisualizationElement):
package_includes = []

def __init__(
self, portrayal_method, canvas_height=500, canvas_width=500, library="sigma"
self,
portrayal_method,
canvas_height=500,
canvas_width=500,
):
library_types = ["sigma", "d3"]
if library not in library_types:
raise ValueError(
f"Invalid javascript library type. Expected one of: {library_types}"
)

NetworkModule.package_includes = (
["NetworkModule_sigma.js", "sigma.min.js"]
if library == "sigma"
else ["NetworkModule_d3.js", D3_JS_FILE]
)
NetworkModule.package_includes = ["NetworkModule_d3.js", D3_JS_FILE]

self.portrayal_method = portrayal_method
self.canvas_height = canvas_height
Expand Down
52 changes: 0 additions & 52 deletions mesa/visualization/templates/js/NetworkModule_sigma.js

This file was deleted.

5 changes: 0 additions & 5 deletions mesa/visualization/templates/js/sigma.min.js

This file was deleted.

0 comments on commit e549107

Please sign in to comment.