Project 1 : Phase 1 - PowerPoint PPT Presentation

About This Presentation
Title:

Project 1 : Phase 1

Description:

Project 1 : Phase 1 22C:021 CS II Data Structures Project 1 Plan Part I (for week 1) Turn the myListGraph class into a generic class. Implement clusteringCoefficient ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 10
Provided by: Uda92
Category:
Tags: phase | project

less

Transcript and Presenter's Notes

Title: Project 1 : Phase 1


1
Project 1 Phase 1
  • 22C021 CS II
  • Data Structures

2
Project 1 Plan
  • Part I (for week 1)
  • Turn the myListGraph class into a generic class.
  • Implement clusteringCoefficient(v) and
    clusteringCoefficient()
  • Add an additional data member to the myListGraph
    class called locations to keep track of an
    array of points.
  • Add the constructor myListGraph(n, d, p) to
    myListGraph.

3
Project 1 Plan
  • Part II (for week 2)
  • Implement the methods in the myListGraph class to
    compute average path length.
  • Part II (for week 3)
  • Run experiments, gather data, make plots, and
    write report.

4
Making myListGraph Generic
  • The List class needs to be made generic to store
    values of type supplied by the user of class
  • The LinkList class needs to be made generic to
    pass down values of correct type to Link
  • The myListGraph class needs to be made generic to
    pass down values of correct type to LinkList.

5
Making myListGraph Generic
  • Correct way of instantiating arrays of Generic
    types
  • theItems (AnyType) new Object newCapacity

6
Code to Test Generic myListGraph
  • Will soon be available on class webpage

7
Clustering Coefficient Algorithm
  • For a vertex V with n neighbors, there exist
  • Q (n choose 2) n(n 1) / 2 total pairs
  • Find total number of pairs of neighbors that
    actually have connections, call this P
  • Compute the clustering cofficient Cv for V as
  • Cv P / Q
  • The algorithm to find such pairs of connected
    nodes is similar to listTriangles from Assignment
    2

8
Why do we need locations
  • We need to know the locations of points within
    our square to find distances between them.
  • This variable will store the location of ith
    vertex at index i in locations array.
  • Computing distances between points
  • Distance Sqrt ((x2 - x1)2 (y2 - y1)2)
  • Review project 1 problem to see why distances
    between points is important

9
Using Probability factor
  • While generating a graph, probably factor p
    determines if we connect to another of our
    neighbors or to a non-neighbor
  • To use this factor, generate a floating random
    number and compare it with p
  • If the generated number is less than p, connect
    to a non-neighbor
  • Otherwise, connect to your neighbor
Write a Comment
User Comments (0)
About PowerShow.com