Bridges-Python
3.4.4
Bridges(Python API)
|
The bridges class is the main class that provides interfaces to datasets, maintains user and assignment information, and connects to the bridges server.
The bridges class is responsible for initializing the bridges system, specifying parameters (user id, assignment id, title, description, data structure type, etc) for the student assignment, generating the data structure representation and transmission to the bridges server. In addition, it provides interfaces to a number of real-world datasets, that makes it easy to access the data for use algorithms/data structure assignments.
Datasets. The datasets that are currently supported through the BRIDGES API include USGS Earthquake Data, IMDB Actor/Movie Data (2 versions), Gutenberg Book Collection Meta Data, a Video Game Dataset, Shakespeare Dataset, OpenStreetMap and Elevation map data. More information is found in the respective methods (below) and at https://bridgesuncc.github.io/datasets.html
A typical bridges program includes creating the bridges object, followed by creation of the data structure by the user, assigning visual attributes to elements of the data structure, followed by specification of teh data structure type and the call to visualize the data structure (bridges::setDataStructure() and visualize() methods).
Public Member Functions | |
[float] | window (self) |
This function returns the current window size. More... | |
None | window (self, [float] value) |
This function sets the current window size that will rendered by default in the view. More... | |
bool | debug (self) |
None | debug (self, bool value) |
def | __init__ (self, int assignment, str username=None, str appl_id=None) |
Bridges constructor. More... | |
def | set_data_structure (self, ds) |
Set the data structure type. More... | |
bool | element_label_flag (self) |
def | element_label_flag (self, bool flag) |
This method controls if the labels for the elements of the visualization are to be on or off. More... | |
bool | link_label_flag (self) |
def | link_label_flag (self, bool flag) |
This method controls if the labels for the links in the visualization are to be on or off. More... | |
bool | get_json_flag (self) |
This method returns the json flag, which controls if the json is to be printed. More... | |
def | set_json_flag (self, bool flag) |
This method controls if the data structure's JSON representation is printed to the console or not. More... | |
def | post_visualization_link (self, bool flag) |
This method controls (with a flag) if the visualization url is printed to the console or not. More... | |
None | visualize (self) |
Method for generating the representation of the data structure in the form of JSON and sends the information to the bridges server for generating the visualization. More... | |
def | get_visualize_url (self) |
def | set_assignment (self, int assignment) |
Setter for assignment id (must be positive) More... | |
str | get_assignment (self) |
Getter for the assignment id. More... | |
None | set_title (self, str title) |
Setter for the title of the bridges visualization. More... | |
None | set_description (self, str description) |
Setter for the description of the bridges visualization. More... | |
def | set_map_overlay (self, bool flag) |
Setter for if the visualization will have a map overlay. More... | |
list | map (self) |
None | map (self, list new_map) |
Setter function for the svg map overlay describing which map to use and the information from that map. More... | |
def | set_coord_system_type (self, coord) |
Setter for the coordinate system type to use in the visualization. More... | |
ColorGrid | get_color_grid_from_assignment (self, str user, int assignment, int subassignment=0) |
Reconstruct a ColorGrid from an existing ColorGrid on the bridges server. More... | |
def | set_username (self, username) |
Setter for username (must be a string) More... | |
def | get_username (self) |
Getter for the assignment user name (BRIDGES credentials) More... | |
def | get_assignment_id (self) |
Getter for the assignment number. More... | |
def | set_key (self, apikey) |
Setter for API Key (BRIDGES Credentials) More... | |
def | get_key (self) |
Getter for the API key (BRIDGES credentials) More... | |
None | set_server_url (self, str server_url) |
Sets url for the output of the visualize method. More... | |
Public Attributes | |
connector | |
ds_handle | |
vis_type | |
def bridges.bridges.Bridges.__init__ | ( | self, | |
int | assignment, | ||
str | username = None , |
||
str | appl_id = None |
||
) |
Bridges constructor.
(int) assignment: the number your bridges assignment will have (str) username: your bridges username, optional if BRIDGES_USER_NAME in env (str) appl_id: your appl authentication key from bridges acc, optional if BRIDGES_API_KEY in env
bool bridges.bridges.Bridges.debug | ( | self | ) |
None bridges.bridges.Bridges.debug | ( | self, | |
bool | value | ||
) |
bool bridges.bridges.Bridges.element_label_flag | ( | self | ) |
def bridges.bridges.Bridges.element_label_flag | ( | self, | |
bool | flag | ||
) |
This method controls if the labels for the elements of the visualization are to be on or off.
flag | flag that controls the labels |
str bridges.bridges.Bridges.get_assignment | ( | self | ) |
Getter for the assignment id.
def bridges.bridges.Bridges.get_assignment_id | ( | self | ) |
Getter for the assignment number.
ColorGrid bridges.bridges.Bridges.get_color_grid_from_assignment | ( | self, | |
str | user, | ||
int | assignment, | ||
int | subassignment = 0 |
||
) |
Reconstruct a ColorGrid from an existing ColorGrid on the bridges server.
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
subassignment | the ID of the subassignment to get (default 0) |
bool bridges.bridges.Bridges.get_json_flag | ( | self | ) |
This method returns the json flag, which controls if the json is to be printed.
def bridges.bridges.Bridges.get_key | ( | self | ) |
Getter for the API key (BRIDGES credentials)
def bridges.bridges.Bridges.get_username | ( | self | ) |
Getter for the assignment user name (BRIDGES credentials)
def bridges.bridges.Bridges.get_visualize_url | ( | self | ) |
bool bridges.bridges.Bridges.link_label_flag | ( | self | ) |
def bridges.bridges.Bridges.link_label_flag | ( | self, | |
bool | flag | ||
) |
This method controls if the labels for the links in the visualization are to be on or off.
flag | flag that controls the labels |
list bridges.bridges.Bridges.map | ( | self | ) |
None bridges.bridges.Bridges.map | ( | self, | |
list | new_map | ||
) |
Setter function for the svg map overlay describing which map to use and the information from that map.
new_map | is a list with the first element describing which map: "us" or "world", and the second element describing what part of the map: a state name or country name respectively. |
def bridges.bridges.Bridges.post_visualization_link | ( | self, | |
bool | flag | ||
) |
This method controls (with a flag) if the visualization url is printed to the console or not.
flag | flag that controls if the url to the visualization is output to console |
def bridges.bridges.Bridges.set_assignment | ( | self, | |
int | assignment | ||
) |
Setter for assignment id (must be positive)
assignment | assignment number to be set |
def bridges.bridges.Bridges.set_coord_system_type | ( | self, | |
coord | |||
) |
Setter for the coordinate system type to use in the visualization.
coord | coordinate system type (used in map overlays (can be "cartesian", "albersusa", "equirectangular") |
def bridges.bridges.Bridges.set_data_structure | ( | self, | |
ds | |||
) |
Set the data structure type.
This method sets the handle to the current data structure; this can be an array, the head of a linked list, root of a tree structure, a graph Arrays of upto 3 dimensions are suppported. It can be any of the data structures supported by BRIDGES. Polymorphism and type casting is used to determine the actual data structure and extract its representtion.
ds | the data structure to visualize |
ValueError | if it is not a BRIDGES data structure |
None bridges.bridges.Bridges.set_description | ( | self, | |
str | description | ||
) |
Setter for the description of the bridges visualization.
(str) description: representing the assignment description
def bridges.bridges.Bridges.set_json_flag | ( | self, | |
bool | flag | ||
) |
This method controls if the data structure's JSON representation is printed to the console or not.
flag | flag that controls if the JSON of the data structure representation is output to console |
def bridges.bridges.Bridges.set_key | ( | self, | |
apikey | |||
) |
Setter for API Key (BRIDGES Credentials)
apikey | api key to be set |
def bridges.bridges.Bridges.set_map_overlay | ( | self, | |
bool | flag | ||
) |
Setter for if the visualization will have a map overlay.
(bool) flag: boolean for if map overlay
None bridges.bridges.Bridges.set_server_url | ( | self, | |
str | server_url | ||
) |
Sets url for the output of the visualize method.
server_url | string, must be one of {live, clone, local, games} |
None bridges.bridges.Bridges.set_title | ( | self, | |
str | title | ||
) |
Setter for the title of the bridges visualization.
(str) title: representing the title
def bridges.bridges.Bridges.set_username | ( | self, | |
username | |||
) |
Setter for username (must be a string)
username | username to be set |
None bridges.bridges.Bridges.visualize | ( | self | ) |
Method for generating the representation of the data structure in the form of JSON and sends the information to the bridges server for generating the visualization.
[float] bridges.bridges.Bridges.window | ( | self | ) |
This function returns the current window size.
This only works for graph data types. And the coordinate system need to be set to "window" using set_coord_system_type(), setting this value will set "window" for you.
None bridges.bridges.Bridges.window | ( | self, | |
[float] | value | ||
) |
This function sets the current window size that will rendered by default in the view.
This only works for graph data types. And the coordinate system need to be set to "window" using set_coord_system_type(), setting this value will set "window" for you.
bridges.bridges.Bridges.connector |
bridges.bridges.Bridges.ds_handle |
bridges.bridges.Bridges.vis_type |