Bridges-Python  3.2.0
Bridges(PythonAPI)
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 http://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

def window (self)
 This function returns the current window size. More...
 
def window
 This function sets the current window size that will rendered by default in the view. More...
 
def __init__ (self, assignment, username=None, appl_id=None)
 Bridges constructor. More...
 
def set_data_structure (self, ds)
 Set the data structure type. More...
 
def set_visualize_JSON (self, flag)
 This method controls if the data structure's JSON representation is printed to the console or not. More...
 
def post_visualization_link (self, flag)
 This method controls (with a flag) if the visualization url is printed to the console or not. More...
 
def 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 set_assignment (self, assignment)
 Setter for assignment id (must be positive) More...
 
def get_assignment (self)
 Getter for the assignment id. More...
 
def set_title (self, title)
 Setter for the title of the bridges visualization. More...
 
def set_description (self, description)
 Setter for the description of the bridges visualization. More...
 
def set_map_overlay (self, flag)
 Setter for if the visualization will have a map overlay. More...
 
def set_coord_system_type (self, coord)
 Setter for the coordinate system type to use in the visualization. More...
 
def get_color_grid_from_assignment
 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...
 
def set_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,
  assignment,
  username = None,
  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

◆ get_assignment()

def bridges.bridges.Bridges.get_assignment (   self,
  str 
)

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

def bridges.bridges.Bridges.get_color_grid_from_assignment (   self,
  user 
)

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_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

◆ post_visualization_link()

def bridges.bridges.Bridges.post_visualization_link (   self,
  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,
  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()

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

Setter for the description of the bridges visualization.

(str) description: representing the assignment description

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,
  flag 
)

Setter for if the visualization will have a map overlay.

(bool) flag: boolean for if map overlay

Returns
None

◆ set_server_url()

def bridges.bridges.Bridges.set_server_url (   self,
  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()

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

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

◆ set_visualize_JSON()

def bridges.bridges.Bridges.set_visualize_JSON (   self,
  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

◆ visualize()

def bridges.bridges.Bridges.visualize (   self,
  None 
)

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]

def bridges.bridges.Bridges.window (   self,
  float 
)

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]

def bridges.bridges.Bridges.window (   self,
  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: