Tabnine Logo
GraphCommunity
Code IndexAdd Tabnine to your IDE (free)

How to use
GraphCommunity
in
com.oculusinfo.tilegen.graph.analytics

Best Java code snippets using com.oculusinfo.tilegen.graph.analytics.GraphCommunity (Showing top 16 results out of 315)

origin: unchartedsoftware/aperture-tiles

/**
 * Add an inter-community edge to an existing community, summing counts as needed, and keeping
 * the MAX_EDGES largest edges.
 */
public void addInterEdgeToCommunity(GraphEdge newEdge) {
  
  LinkedList<GraphEdge> accumulatedEdges = new LinkedList<>(_interEdges);
  addEdgeInPlace(accumulatedEdges, newEdge);
  _interEdges = accumulatedEdges;    
}

origin: unchartedsoftware/aperture-tiles

if (this.getHierLevel() != that.getHierLevel()) {
  return false;
else if ((this.getID() != that.getID())) {
  return false;
else if (!(this.getCoords().equals(that.getCoords()))) {
  return false;
else if ((this.getRadius() != that.getRadius())) {
  return false;
else if ((this.getDegree() != that.getDegree())) {
  return false;
else if ((this.getNumNodes() != that.getNumNodes())) {
  return false;
else if (!(this.getMetadata().equals(that.getMetadata()))) {
  return false;
else if ((this.isPrimaryNode() != that.isPrimaryNode())) {
  return false;
else if ((this.getParentID() != that.getParentID())) {
  return false;
else if (!(this.getParentCoords().equals(that.getParentCoords()))) {
  return false;
origin: unchartedsoftware/aperture-tiles

public void minInPlace(GraphCommunity b) {
  
  double x = Math.min(this.getCoords().getFirst(), b.getCoords().getFirst());
  double y = Math.min(this.getCoords().getSecond(), b.getCoords().getSecond());
  double px = Math.min(this.getParentCoords().getFirst(), b.getParentCoords().getFirst());
  double py = Math.min(this.getParentCoords().getSecond(), b.getParentCoords().getSecond());
  
  _hierLevel = Math.min(this.getHierLevel(), b.getHierLevel());
  _id = Math.min(this.getID(), b.getID());
  _coords = new Pair<Double, Double>(x,y);
  _radius = Math.min(this.getRadius(), b.getRadius());
  _degree = Math.min(this.getDegree(), b.getDegree());
  _numNodes = Math.min(this.getNumNodes(), b.getNumNodes());
  _metadata = "";
  _bIsPrimaryNode    = false;	
  _parentID = Math.min(this.getParentID(), b.getParentID());
  _parentCoords = new Pair<Double, Double>(px,py);
  _parentRadius = Math.min(this.getParentRadius(), b.getParentRadius());
  _communityStats = minOfStatsList(this.getStatsList().get(0), b.getStatsList());		
  _interEdges = minOfEdgeLists(this.getInterEdges().get(0), b.getInterEdges());
  _intraEdges = minOfEdgeLists(this.getIntraEdges().get(0), b.getIntraEdges());
}
origin: unchartedsoftware/aperture-tiles

public void maxInPlace(GraphCommunity b) {
  
  double x = Math.max(this.getCoords().getFirst(), b.getCoords().getFirst());
  double y = Math.max(this.getCoords().getSecond(), b.getCoords().getSecond());
  double px = Math.max(this.getParentCoords().getFirst(), b.getParentCoords().getFirst());
  double py = Math.max(this.getParentCoords().getSecond(), b.getParentCoords().getSecond());
  
  _hierLevel = Math.max(this.getHierLevel(), b.getHierLevel());
  _id = Math.max(this.getID(), b.getID());
  _coords = new Pair<Double, Double>(x,y);
  _radius = Math.max(this.getRadius(), b.getRadius());
  _degree = Math.max(this.getDegree(), b.getDegree());
  _numNodes = Math.max(this.getNumNodes(), b.getNumNodes());
  _metadata = "";
  _bIsPrimaryNode    = false;	
  _parentID = Math.max(this.getParentID(), b.getParentID());
  _parentCoords = new Pair<Double, Double>(px,py);
  _parentRadius = Math.max(this.getParentRadius(), b.getParentRadius());
  _communityStats = maxOfStatsList(this.getStatsList().get(0), b.getStatsList());
  _interEdges = maxOfEdgeLists(this.getInterEdges().get(0), b.getInterEdges());
  _intraEdges = maxOfEdgeLists(this.getIntraEdges().get(0), b.getIntraEdges());		
}    
  
origin: unchartedsoftware/aperture-tiles

results.add(new GraphCommunity((Integer)value.get("hierLevel"),
                (Long)value.get("id"),
                new Pair<Double, Double>((Double)value.get("x"), (Double)value.get("y")),
origin: unchartedsoftware/aperture-tiles

GraphCommunity next = i.next();
size++;
int hierLevel = next.getHierLevel();
if (hierLevel != newCommunity.getHierLevel()) {
  throw new IllegalArgumentException("Cannot aggegrate communities from different hierarchy levels.");
if ((hierLevel==0 && next.getDegree() < newCommunity.getDegree()) || 		//TODO -- ideally, could use 'weighted degree' here 
  (hierLevel>0 && next.getNumNodes() < newCommunity.getNumNodes())) {
origin: unchartedsoftware/aperture-tiles

@Test
public void testInterEdgeToCommunity () {
  GraphCommunity a = _sampleCommunity;
  GraphEdge e1 = new GraphEdge(987L, 0.1, 0.2, 999L);
  GraphCommunity b = a;
  b.addInterEdgeToCommunity(e1);
  
  List<GraphEdge> edges = Arrays.asList(e1, 
                    new GraphEdge(0L, 4.3, 2.1, 5L),
                    new GraphEdge(43L, 5.6, 7.8, 3L));
  
  GraphCommunity c = new GraphCommunity(_hierLevel, 
                    _id, 
                    _coords,
                    _radius,
                    _degree,
                    _numNodes,
                    _metadata,
                    _bIsPrimaryNode,
                    _parentID,
                    _parentCoords,
                    _parentRadius,
                    _statsList,
                    edges,
                    _intraEdges);
  Assert.assertEquals(c, b);
}

origin: unchartedsoftware/aperture-tiles

@Test
public void testIntraEdgeToCommunity () {
  GraphCommunity a = _sampleCommunity;
  GraphEdge e2 = new GraphEdge(988L, 0.11, 0.22, 1L);
  GraphCommunity b = a;
  b.addIntraEdgeToCommunity(e2);
  
  List<GraphEdge> edges = Arrays.asList(new GraphEdge(2L, 4.2, 2.0, 6L),
                    new GraphEdge(44L, 5.5, 7.7, 4L),
                    e2);
  
  GraphCommunity c = new GraphCommunity(_hierLevel, 
                    _id, 
                    _coords,
                    _radius,
                    _degree,
                    _numNodes,
                    _metadata,
                    _bIsPrimaryNode,
                    _parentID,
                    _parentCoords,
                    _parentRadius,
                    _statsList,
                    _interEdges,
                    edges);
  Assert.assertEquals(c, b);
}

origin: unchartedsoftware/aperture-tiles

@Test
public void testCommunityToRecord () {
  GraphAnalyticsRecord a = new GraphAnalyticsRecord(1, Arrays.asList(_sampleCommunity));
  
  GraphCommunity community_b = new GraphCommunity(_hierLevel, 
                          456L, 
                          new Pair<Double, Double>(3.3, 4.4),
                          3.4,
                          4,
                          54,
                          "blah4\tblah5",
                          true,
                          _parentID,
                          _parentCoords,
                          _parentRadius,
                          _statsList,
                          _interEdges,
                          _intraEdges);
  GraphAnalyticsRecord c = new GraphAnalyticsRecord(2, Arrays.asList(community_b, _sampleCommunity));		
  Assert.assertEquals(c, GraphAnalyticsRecord.addCommunityToRecord(a, community_b));
}

origin: unchartedsoftware/aperture-tiles

result += "{\"hierLevel\": " + node.getHierLevel() + ", "
       + "\"id\": " + node.getID() + ", "
       + "\"coords\": [" + node.getCoords().getFirst() + ", " + node.getCoords().getSecond() + "], "
       + "\"radius\": " + node.getRadius() + ", "
       + "\"degree\": " + node.getDegree() + ", "
       + "\"numNodes\": " + node.getNumNodes() + ", "
       + "\"metadata\": " + escapeString(node.getMetadata()) + ", "
       + "\"isPrimaryNode\": " + node.isPrimaryNode() + ", "
       + "\"parentID\": " + node.getParentID() + ", "
       + "\"parentCoords\": [" + node.getParentCoords().getFirst() + ", " + node.getParentCoords().getSecond() + "], "
       + "\"parentRadius\": " + node.getParentRadius() + ", ";
if (node.getStatsList() != null) {
  for (int n = 0; n < node.getStatsList().size(); n++) {
    if (n > 0)
      result += ", ";
    result += node.getStatsList().get(n);
if (node.getInterEdges() != null) {
  for (int n = 0; n < node.getInterEdges().size(); n++) {
    GraphEdge edge = node.getInterEdges().get(n);
    if (n > 0)
      result += ", ";
if (node.getIntraEdges() != null) {
  for (int n = 0; n < node.getIntraEdges().size(); n++) {
    GraphEdge edge = node.getIntraEdges().get(n);
    if (n > 0)
origin: unchartedsoftware/aperture-tiles

@Test
public void testRecordAggregation () {
  GraphAnalyticsRecord a = new GraphAnalyticsRecord(1, Arrays.asList(_sampleCommunity));
  
  GraphCommunity community_b = new GraphCommunity(_hierLevel, 
                          456L, 
                          new Pair<Double, Double>(3.3, 4.4),
                          3.4,
                          4,
                          54,
                          "blah4\tblah5",
                          true,
                          _parentID,
                          _parentCoords,
                          _parentRadius,
                          _statsList,
                          _interEdges,
                          _intraEdges);
  GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b));
  GraphAnalyticsRecord c = new GraphAnalyticsRecord(2, Arrays.asList(community_b, _sampleCommunity));		
  Assert.assertEquals(c, GraphAnalyticsRecord.addRecords(a, b));
}

origin: unchartedsoftware/aperture-tiles

/**
 * Add an intra-community edge to an existing community, summing counts as needed, and keeping
 * the MAX_EDGES largest edges.
 */
public void addIntraEdgeToCommunity(GraphEdge newEdge) {
  
  LinkedList<GraphEdge> accumulatedEdges = new LinkedList<>(_intraEdges);
  addEdgeInPlace(accumulatedEdges, newEdge);
  _intraEdges = accumulatedEdges;    
}
origin: unchartedsoftware/aperture-tiles

GenericRecord elt = new GenericData.Record(eltSchema);
GraphCommunity rawElt = elts.get(i);
elt.put("hierLevel", rawElt.getHierLevel());
elt.put("id", rawElt.getID());
elt.put("x", rawElt.getCoords().getFirst());
elt.put("y", rawElt.getCoords().getSecond());
elt.put("r", rawElt.getRadius());
elt.put("degree", rawElt.getDegree());
elt.put("numNodes", rawElt.getNumNodes());
elt.put("metadata", rawElt.getMetadata());
elt.put("isPrimaryNode", rawElt.isPrimaryNode());
elt.put("parentID", rawElt.getParentID());
elt.put("parentX", rawElt.getParentCoords().getFirst());
elt.put("parentY", rawElt.getParentCoords().getSecond());
elt.put("parentR", rawElt.getParentRadius());
List<Double> statsList = rawElt.getStatsList();
elt.put("statsList", statsList);
List<GraphEdge> interEdges = rawElt.getInterEdges();
for (int n=0; n < interEdges.size(); n++) {
  GenericRecord edge = new GenericData.Record(interEschema);
List<GraphEdge> intraEdges = rawElt.getIntraEdges();
for (int n=0; n < intraEdges.size(); n++) {
  GenericRecord edge = new GenericData.Record(intraEschema);
origin: unchartedsoftware/aperture-tiles

@Test
public void testEmptyRecordAggregation () {
  GraphAnalyticsRecord a = new GraphAnalyticsRecord(0, null);
  
  GraphCommunity community_b = new GraphCommunity(_hierLevel, 
                          456L, 
                          new Pair<Double, Double>(3.3, 4.4),
                          3.4,
                          4,
                          54,
                          "blah4\tblah5",
                          true,
                          _parentID,
                          _parentCoords,
                          _parentRadius,
                          _statsList,
                          _interEdges,
                          _intraEdges);
  GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b));
  Assert.assertEquals(b, GraphAnalyticsRecord.addRecords(a, b));
}

origin: unchartedsoftware/aperture-tiles

GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b));
GraphCommunity community_c = new GraphCommunity(1, 
    123L, 
    new Pair<Double, Double>(1.2, 3.4),
origin: unchartedsoftware/aperture-tiles

GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b));
GraphCommunity community_c = new GraphCommunity(1, 
    567L, 
    new Pair<Double, Double>(3.3, 4.4),
com.oculusinfo.tilegen.graph.analyticsGraphCommunity

Javadoc

Class for a storing a graph community object. Used by GraphAnalyticsRecord for graph analytics tile generation. Contains info about a graph community's size, location, ID, generic metadata, its parent graph community (if applicable), as well as the MAX_EDGES highest weighted inter-community and intra-community edges connected to the graph community. Edge info is stored in lists of GraphEdge objects, ranked by weight (highest to lowest).

Most used methods

  • <init>
  • addEdgeInPlace
  • addInterEdgeToCommunity
    Add an inter-community edge to an existing community, summing counts as needed, and keeping the MAX_
  • addIntraEdgeToCommunity
    Add an intra-community edge to an existing community, summing counts as needed, and keeping the MAX_
  • getCoords
  • getDegree
  • getHierLevel
  • getID
  • getInterEdges
  • getIntraEdges
  • getMetadata
  • getNumNodes
  • getMetadata,
  • getNumNodes,
  • getParentCoords,
  • getParentID,
  • getParentRadius,
  • getRadius,
  • getStatsList,
  • isPrimaryNode,
  • listsEqual,
  • maxInPlace

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
  • compareTo (BigDecimal)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now