My Math Forum  

Go Back   My Math Forum > College Math Forum > Applied Math

Applied Math Applied Math Forum


Reply
 
LinkBack Thread Tools Display Modes
July 27th, 2017, 02:39 AM   #1
Newbie
 
Joined: Jul 2017
From: Cagliari

Posts: 1
Thanks: 0

Generating a linear system for popularity calculation

This is a half mathematical half computer science question. I am working on matlab on a mathematical problem.
I want to generate a linear system for the calculation of popularity of people (a vector $\displaystyle x$) in a generic social network, given a simple matrix of friendship $\displaystyle F$. If user 1 and user 2 are friends, $\displaystyle F(1,2)=1$ but also $\displaystyle F(2,1)=1$ (the friendship is bidirectional). To transform this problem in a linear system I need that the popularity value of a person ($\displaystyle x(i)$) and the popularity of all his friends ($\displaystyle ∀x(j) | F(i,j)=1 and j≠i$) are linearly dependent. So I wrote this simple formula

$\displaystyle x(j) = sum(x(i) x n(i) x F(i,j)) ∀i≠j$
where $\displaystyle n(i)$ is the number of friends of i.

For $\displaystyle size(x)=3$ the system is something like this

Code:
    -x(1) + f(1,2) n(2) x(2) + f(1,3) n(3) = 0 
    f(2,1) n(1) x(1) - x(2) + f(1,3) n(3) x(3) = 0 
    f(3,1) n(1) x(1) + f(1,2) n(2) x(2) - x(3) = 0
With this specific formula, there are two problems:
  1. With no constant term, the solution found is $\displaystyle x(i)=0 ∀i$
  1. I need positive values of popularity, but this approach gave also some negative (and correct!) results.

So I need a formula that doesn't have these two problems. The formula can be chosen arbitrarily because the problem is totally defined by me. It must take account of friendship relations and number of friends in a linear combination (necessary to get a linear system), but also be positive.
Here the code of the generation and resolution of the system

Code:
n=10;
    F=triu(randi([0,1],n));
    F=F-diag(diag(F));
    F=F+F';
    N=(sum(F))';
    A=ones(n);
    
    for i=1:n
        A(:,i)=diag(N)*F(:,i);
    end
    A=A-eye(n);
    b=zeros(n,1);
    x=A\b

Last edited by skipjack; July 27th, 2017 at 08:38 AM.
ela92 is offline  
 
Reply

  My Math Forum > College Math Forum > Applied Math

Tags
calculation, generating, linear, linear system equations, popularity, problem generation, system



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linear approximation of Non linear system by Taylor series RGNIT Calculus 0 March 21st, 2014 12:21 AM
Popularity or agreeance of relations 667 Applied Math 1 January 24th, 2014 09:31 AM
Hamiltonian system, plotting and energy calculation ihavenoidea Applied Math 0 June 8th, 2013 10:20 AM
Solve nonlinear system (=linear+linear systems) tools Linear Algebra 1 September 21st, 2012 01:38 PM
Popularity SidT New Users 1 June 27th, 2008 01:48 PM





Copyright © 2017 My Math Forum. All rights reserved.