Bridges-Python  3.4.4
Bridges(Python API)
Public Member Functions | Public Attributes | List of all members
bridges.bridges.Bridges Class Reference

Detailed Description

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).

Author
Sean Gallagher, Kalpathi Subramanaian, Mihai Mehedint, David Burlinson, Matthew Mcquaigue, Erik Saule, Jamie Payton
Date
2015, 2016, 2017, 2018, 2019, 2020, 2021

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
 

Constructor & Destructor Documentation

◆ __init__()

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
Returns
None

Member Function Documentation

◆ debug() [1/2]

bool bridges.bridges.Bridges.debug (   self)

◆ debug() [2/2]

None bridges.bridges.Bridges.debug (   self,
bool  value 
)

◆ element_label_flag() [1/2]

bool bridges.bridges.Bridges.element_label_flag (   self)

◆ element_label_flag() [2/2]

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.

Parameters
flagflag that controls the labels
Returns
None

◆ get_assignment()

str bridges.bridges.Bridges.get_assignment (   self)

Getter for the assignment id.

Returns
str representing the full assignment id including subassignment aspect

◆ get_assignment_id()

def bridges.bridges.Bridges.get_assignment_id (   self)

Getter for the assignment number.

Returns
int assignment number

◆ get_color_grid_from_assignment()

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.

Parameters
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get
subassignmentthe ID of the subassignment to get (default 0)
Returns
ColorGrid the ColorGrid stored in the bridges server

◆ get_json_flag()

bool bridges.bridges.Bridges.get_json_flag (   self)

This method returns the json flag, which controls if the json is to be printed.

◆ get_key()

def bridges.bridges.Bridges.get_key (   self)

Getter for the API key (BRIDGES credentials)

Returns
str user's API key

◆ get_username()

def bridges.bridges.Bridges.get_username (   self)

Getter for the assignment user name (BRIDGES credentials)

Returns
str user name

◆ get_visualize_url()

def bridges.bridges.Bridges.get_visualize_url (   self)

◆ link_label_flag() [1/2]

bool bridges.bridges.Bridges.link_label_flag (   self)

◆ link_label_flag() [2/2]

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.

Parameters
flagflag that controls the labels
Returns
None

◆ map() [1/2]

list bridges.bridges.Bridges.map (   self)

◆ map() [2/2]

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.

Parameters
new_mapis 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.
Returns
None

◆ post_visualization_link()

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.

Parameters
flagflag that controls if the url to the visualization is output to console

◆ set_assignment()

def bridges.bridges.Bridges.set_assignment (   self,
int  assignment 
)

Setter for assignment id (must be positive)

Parameters
assignmentassignment number to be set
Returns
None

◆ set_coord_system_type()

def bridges.bridges.Bridges.set_coord_system_type (   self,
  coord 
)

Setter for the coordinate system type to use in the visualization.

Parameters
coordcoordinate system type (used in map overlays (can be "cartesian", "albersusa", "equirectangular")

◆ set_data_structure()

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.

Parameters
dsthe data structure to visualize
Returns
None
Exceptions
ValueErrorif it is not a BRIDGES data structure

◆ set_description()

None bridges.bridges.Bridges.set_description (   self,
str  description 
)

Setter for the description of the bridges visualization.

       (str) description: representing the assignment description
Returns
None

◆ set_json_flag()

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.

Parameters
flagflag that controls if the JSON of the data structure representation is output to console
Returns
None

◆ set_key()

def bridges.bridges.Bridges.set_key (   self,
  apikey 
)

Setter for API Key (BRIDGES Credentials)

Parameters
apikeyapi key to be set
Returns
None

◆ set_map_overlay()

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
Returns
None

◆ set_server_url()

None bridges.bridges.Bridges.set_server_url (   self,
str  server_url 
)

Sets url for the output of the visualize method.

Parameters
server_urlstring, must be one of {live, clone, local, games}
Returns
None

◆ set_title()

None bridges.bridges.Bridges.set_title (   self,
str  title 
)

Setter for the title of the bridges visualization.

       (str) title: representing the title
Returns
None

◆ set_username()

def bridges.bridges.Bridges.set_username (   self,
  username 
)

Setter for username (must be a string)

Parameters
usernameusername to be set
Returns
None

◆ visualize()

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.

Returns
None

◆ window() [1/2]

[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.

Returns
return a list of 4 floats [x1, x2, y1, y2]

◆ window() [2/2]

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.

Member Data Documentation

◆ connector

bridges.bridges.Bridges.connector

◆ ds_handle

bridges.bridges.Bridges.ds_handle

◆ vis_type

bridges.bridges.Bridges.vis_type

The documentation for this class was generated from the following file: