Sie sind auf Seite 1von 10

MADRAS INSTITUTE OF

TECHNOLOGY
ANNA UNIVERSITY, CHENNAI 600 044.

B.Tech Information
Technology(3/8)
1

IT8313 Programming and Data Structures Lab II

SOCIAL NETWORKING
SYSTEM
Project members:
S.No.

Name

Register no.

1.

SANJAYANBU.A

2013506100

2.

SANTHOSHKUMAR.D 2013506101

Project Guide:
Mrs. B.Lydia Elizabeth ,
I

T Department,
Madras Institute of Technology,
Anna University, Chennai- 600 044.
2

INTRODUCTION:
Social networking system mainly coordinates
people and helps to find people having common things in
between them. This project mainly aims to entertain
people. It has many options to entertain. Some of them
are finding friends, Sending messages to friends.

SOCIAL NETWORKING:
This project aims to entertain people by sending
messages to friends and also helps to gain new friends. In
this project, Each user has given a separate login system
to enter into the menu. The menu displays several
choices. The user has to input his choice based on his
wish. The corresponding function is called.

DATA STRUCTURES USED:


GRAPHS:

When a user enters into the find friends


functions, he selects one of the many friends displayed in
the menu. When the user selects a certain friend, the
profile details of the selected user is displayed. The user
must give a friend request to the user before sending
messages.
When the user gives a friend request, an
edge is created between the user and the friend using
graphs. It is easy to search a person in the graph. When
the other user logins the system, he would receive a
notification stating he has a friend request. When he
accepts the friend request, other edge is created between
the user and the friend.
Here, the graph is implemented using linked
list. So, that many number of users can access the
system. When an edge is created between a user and his
friend, the weight of the corresponding edge is assigned
to 1. The array containing the weight of the edges is
stored in the file while can be used for permanent usage.

Source code:
Implementation of Graphs:
struct AdjListNode
{
int dest;
struct AdjListNode* next;
};
4

struct AdjList
{
struct AdjListNode *head;
};
struct Graph
{
int V;
struct AdjList* array;
};
struct AdjListNode* newAdjListNode(int dest)
{
struct AdjListNode* newNode =
(struct AdjListNode*) malloc(sizeof(struct
AdjListNode));
newNode->dest = dest;
newNode->next = NULL;
return newNode;
}
struct Graph* createGraph(int V)
{
5

struct Graph* graph = (struct Graph*)


malloc(sizeof(struct Graph));
graph->V = V;
graph->array = (struct AdjList*) malloc(V *
sizeof(struct AdjList));
int i;
for (i = 0; i < V; ++i)
graph->array[i].head = NULL;
return graph;
}
void addEdge(struct Graph* graph, int src, int dest)
{
struct AdjListNode* newNode = newAdjListNode(dest);
newNode->next = graph->array[src].head;
graph->array[src].head = newNode;
}
void printGraph(struct Graph* graph)
{
int v;
for (v = 0; v < graph->V; ++v)
{
6

struct AdjListNode* pCrawl = graph->array[v].head;


printf("\n Adjacency list of vertex %d\n head ", v);
while (pCrawl)
{
printf("-> %d", pCrawl->dest);
pCrawl = pCrawl->next;
}
printf("\n");
}
}

Output:
Implementation of graphs:

Friend requests:

Message exchange between two users:


9

Conclusion:
Thus
program
to
implement
social
networking system using graphs was implemented
successfully and checked with various cases of
input. More additional options can be made based
upon the users request.

10

Das könnte Ihnen auch gefallen