Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:53:27+00:00 2026-05-26T17:53:27+00:00

package edu.uci.ics.jung.algorithms.cluster; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.collections15.Transformer;

  • 0
package edu.uci.ics.jung.algorithms.cluster;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.collections15.Transformer;

import edu.uci.ics.jung.algorithms.scoring.BetweennessCentrality;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.graph.util.Pair;

    public class EdgeBetweennessClusterer<V, E> implements
        Transformer<Graph<V, E>, Set<Set<V>>> {
    private int mNumEdgesToRemove;
    private Map<E, Pair<V>> edges_removed;


    public EdgeBetweennessClusterer(int numEdgesToRemove) {
        mNumEdgesToRemove = numEdgesToRemove;
        edges_removed = new LinkedHashMap<E, Pair<V>>();


    }
      public Set<Set<V>> transform(Graph<V, E> graph) {

        if (mNumEdgesToRemove < 0
                || mNumEdgesToRemove > graph.getEdgeCount()) {
            throw new IllegalArgumentException(
                    "Invalid number of edges passed in.");
        }

        edges_removed.clear();

        for (int k = 0; k < mNumEdgesToRemove; k++) {
            BetweennessCentrality<V, E> bc = new BetweennessCentrality<V, E>(
                    graph);
            E to_remove = null;
            double score = 0;
            for (E e : graph.getEdges())
                if (bc.getEdgeScore(e) > score) {
                    to_remove = e;
                    score = bc.getEdgeScore(e);
                }
            edges_removed.put(to_remove, graph.getEndpoints(to_remove));
            graph.removeEdge(to_remove);
        }

        WeakComponentClusterer<V, E> wcSearch = new WeakComponentClusterer<V, E>();
        Set<Set<V>> clusterSet = wcSearch.transform(graph);

        for (Map.Entry<E, Pair<V>> entry : edges_removed.entrySet()) {
            Pair<V> endpoints = entry.getValue();
            graph.addEdge(entry.getKey(), endpoints.getFirst(),
                    endpoints.getSecond());
        }
        Object array[];
        array=new Object[500];
        array=clusterSet.toArray();
        System.out.println(array.length);
        for(int i=0;i<array.length;i++)

        {
            System.out.println("hello");
            System.out.println("hkj"+array[i]);
        }
        return clusterSet;
    }

    /**
     * Retrieves the list of all edges that were removed
     * (assuming extract(...) was previously called). 
     * The edges returned
     * are stored in order in which they were removed.
     *
     * @return the edges in the original graph
     */
    public List<E> getEdgesRemoved() {
        return new ArrayList<E>(edges_removed.keySet());
    }


    public static void main(String args[])
    {
        new EdgeBetweennessClusterer(10);
    }
}

This algorithm is copied from here

I am making network based community so I used this algorithm
when I am running this code, the main method, and is not getting called. I am not able to understand what is happening. Correct me if I am wrong. What mistake am I making?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:53:28+00:00Added an answer on May 26, 2026 at 5:53 pm

    If you remove all the code which doesn’t do anything your program is the same as

    public EdgeBetweennessClusterer(int numEdgesToRemove) {
        mNumEdgesToRemove = numEdgesToRemove;
        edges_removed = new LinkedHashMap<E, Pair<V>>();
    }
    
    public static void main(String args[]) {
        new EdgeBetweennessClusterer(10);
    }
    

    If you want your program to call more code, you need to tell it to do so. Perhaps using a debugger will help you see what your program is doing any why.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

package sg.edu.rp.c345.p04; import java.util.ArrayList; import java.util.Collections; import android.app.AlertDialog; import android.app.ListActivity; import android.content.DialogInterface; import android.os.Bundle;
package net.learn2develop.PopularAttractions; import java.io.IOException; import java.util.List; import java.util.Locale; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController;
package vaannila; import java.util.ArrayList; import com.opensymphony.xwork2.ActionSupport; public class RegisterAction extends ActionSupport { private String
package com.example.helloandroid; import java.util.ArrayList; import java.util.Arrays; import android.app.TabActivity; import android.os.Bundle; import android.view.Window; import android.widget.ArrayAdapter;
package myProg; import java.util.Scanner; public class oving4a { /** *Øving 4a. Aleksander Pettersen */
package test; import java.awt.*; import java.awt.event.*; import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; import javax.swing.*; public class
package myfirst; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.*; import java.io.FileInputStream; import java.lang.Iterable; import java.net.URL; import java.net.URLConnection;
package com.fitaxis.test; import java.sql.SQLException; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer;
package javaapplication1; import java.io.*; /** * * @author simon */ public class Main {
package pkgPeople; import java.io.Serializable; import java.text.DecimalFormat; public class Person implements Serializable{ private String name;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.