Spectral clustering in R for categorical data with igraph?

I am new to this group and found out about igraph. I am actually new to spectral clustering as well and wish to find out whether igraph library can help me building this algorithm but on categorical data. My data is so much categorical.

Thank you in advance for your answers.


What do you mean by “categorical data”? Can you illustrate it through a concrete example?

here is an example.

Country <- c(“UK”, “India”, “Hungary”)
Chills <- c(“Yes”, “No”)
Temperature <- c(“Ye”, “No”)
tested <-c(“showing symptoms”, “tested positive”)

data <- c(“Country”, “Chills”, “Temperature”, "tested)

as you can see, my variables, country, chills, temperature and tested have categorical levels.

Thank you.

igraph is used for manipulating and analysing networks. I do not see the relationship of your question to networks. Can you clarify?

So, I thought igraph may have function with regards to graph spectrum analysis? And my question is whether there is possibility some algorithms are created to deal with categorical data using variables with categories. Country is one variable, Symptom is another variable (Chills, Cough, Temperature) and Counts per each country. But let me clarify, the process of spectral clustering involves several: 1) Construcing a similarity graph (Knn graph) for all data points; 2) embed data points in a low dimensional space(spectral embedding) - here there is ice of the eigenvectors of the graph Laplacian 3) A classical clustering algorithm ( usually k-means -yet symptom variable is a factor/categorical variable

I have been directed to igraph yet, I haven’t found to much info about it in such a short time. I am hoping to get a clear answer as to whether there are some examples run with this library on spectral clustering.

Assuming you have a graph, spectral clustering can be done with cluster_leading_eigen. You must construct the graph yourself.

thank you. to be honest I have never done such analysis. And my question is: is there an example of this somewhere done by igraph community and advertised? Because when you say, ‘you must construct the graph yourself’ - do not understand it and probably with an example that I may follow, I will be able to understand what it means to construct the graph.

What I meant was that igraph has a function to do spectral clustering on a network. But, as I understand, your source data is not a network. You would like to create a network from it, then run a community detection algorithm on that network.

How to convert your source data to a network will depend on the specifics of your source data, and the specifics of the problem you are trying to solve.

By “you must construct the graph yourself” I meant to say that once you have the graph, it’s a simple matter of using the cluster_leading_eigen function. How to create this network is up to you though. If you can explain how you want to do that, perhaps someone can give advice on how to implement the method you have in mind using igraph.

okay, but you do not answer to my question. Yet, thank you.

I can’t answer this … I’ll only say that I am not aware of one, but there may very well be one. I do not follow the R side closely, I am mostly involved with the C and Mathematica interfaces of igraph.